Closed
Description
fn main() {
let x: &[u32] = &[];
let _ = x.iter();
// ^ hover: {unknown}
let _ = <[u32]>::iter(x);
// ^ hover: {unknown}
}
Using into_iter()
works. In fact, completion on x
doesn't show any of slice's intrinsic methods, only trait methods. I am not sure if this is a regression, I only started noticing it because it leads to false type errors in
fn main() {
struct Foo(u32);
let x: &[Foo] = &[];
fn f(_: &u32) {}
let _ = x.iter().map(|Foo(x)| f(x));
// ^ type-mismatch: expected &u32, found u32
}
rust-analyzer version: 0fe7417 2022-04-02 nightly
rustc version: rustc 1.62.0-nightly (60e50fc1c 2022-04-04)