summaryrefslogtreecommitdiff
path: root/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs')
-rw-r--r--src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
index 009819f0bb5..32052fff90d 100644
--- a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
+++ b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
@@ -300,7 +300,7 @@ fn main() {
let y = &mut x;
&mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
//[mir]~^ ERROR cannot borrow `**x` as mutable more than once at a time (Ast)
- //[mir]~| ERROR cannot borrow `*x` as mutable more than once at a time (Mir)
+ //[mir]~| ERROR cannot borrow `x` as mutable more than once at a time (Mir)
*y = 1;
};
}
@@ -312,9 +312,20 @@ fn main() {
let y = &mut x;
&mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
//[mir]~^ ERROR cannot borrow `**x` as mutable more than once at a time (Ast)
- //[mir]~| ERROR cannot borrow `*x` as mutable more than once at a time (Mir)
+ //[mir]~| ERROR cannot borrow `x` as mutable more than once at a time (Mir)
*y = 1;
}
};
}
+ {
+ fn foo(x: Vec<i32>) {
+ let c = || {
+ drop(x);
+ drop(x); //[ast]~ ERROR use of moved value: `x`
+ //[mir]~^ ERROR use of moved value: `x` (Ast)
+ //[mir]~| ERROR use of moved value: `x` (Mir)
+ };
+ c();
+ }
+ }
}