summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs')
-rw-r--r--tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs b/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
new file mode 100644
index 000000000..254956ae3
--- /dev/null
+++ b/tests/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
@@ -0,0 +1,10 @@
+// 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
+}