about summary refs log tree commit diff
path: root/tests/ui/dropck/drop-with-active-borrows-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/dropck/drop-with-active-borrows-1.rs')
-rw-r--r--tests/ui/dropck/drop-with-active-borrows-1.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/dropck/drop-with-active-borrows-1.rs b/tests/ui/dropck/drop-with-active-borrows-1.rs
new file mode 100644
index 00000000000..1e924af296a
--- /dev/null
+++ b/tests/ui/dropck/drop-with-active-borrows-1.rs
@@ -0,0 +1,8 @@
+fn main() {
+    let a = "".to_string();
+    let b: Vec<&str> = a.lines().collect();
+    drop(a);    //~ ERROR cannot move out of `a` because it is borrowed
+    for s in &b {
+        println!("{}", *s);
+    }
+}