rust/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
254 B
Rust
Raw Normal View History

// Check that we do not suggest `ref f` here in the `main()` function.
struct Foo {
pub v: Vec<String>,
}
fn main() {
let mut f = Foo { v: Vec::new() };
f.v.push("hello".to_string());
let e = f.v[0]; //~ ERROR cannot move out of index
}