diff options
Diffstat (limited to 'src/test/compile-fail/mut-pattern-internal-mutability.rs')
| -rw-r--r-- | src/test/compile-fail/mut-pattern-internal-mutability.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test/compile-fail/mut-pattern-internal-mutability.rs b/src/test/compile-fail/mut-pattern-internal-mutability.rs index b0d618328dc..3a84bd6565e 100644 --- a/src/test/compile-fail/mut-pattern-internal-mutability.rs +++ b/src/test/compile-fail/mut-pattern-internal-mutability.rs @@ -8,11 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir + fn main() { let foo = &mut 1; let &mut x = foo; - x += 1; //~ ERROR re-assignment of immutable variable + x += 1; //[ast]~ ERROR re-assignment of immutable variable + //[mir]~^ ERROR re-assignment of immutable variable `x` (Ast) + //[mir]~| ERROR re-assignment of immutable variable `x` (Mir) // explicitly mut-ify internals let &mut mut x = foo; @@ -20,5 +25,7 @@ fn main() { // check borrowing is detected successfully let &mut ref x = foo; - *foo += 1; //~ ERROR cannot assign to `*foo` because it is borrowed + *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed + //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed (Ast) + //[mir]~| ERROR cannot assign to `(*foo)` because it is borrowed (Mir) } |
