Open
Description
The following produces a R-A error, but compiles just fine:
use smallvec::SmallVec;
const SIZE: usize = 1;
fn bug(ve: &SmallVec<[Option<()>; SIZE]>) -> Option<Option<&()>> {
ve.iter().next().map(|x| x.as_ref())
}
fn main() {}
I haven't been able to come up with a minimal example that does not use SmallVec. ve.iter()
is inferred as Iter<{unknown}>
by RA in that function. Note that this does not error if the array size is written in place: [Option<()>; 1].
This does not happen if I simply replace SmallVec with some type that implements Deref<Target=[Option<()>]>
or &[Option<()>; SIZE]
itself.
rust-analyzer version: rust-analyzer version: 24cf957 2022-04-11 stable
rustc version: rustc 1.62.0-nightly (878c7833f 2022-04-16)