diff options
Diffstat (limited to 'tests/ui/dropck/drop-with-active-borrows-1.rs')
-rw-r--r-- | tests/ui/dropck/drop-with-active-borrows-1.rs | 8 |
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 000000000..1e924af29 --- /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); + } +} |