diff options
| author | Keith Yeung <kungfukeith11@gmail.com> | 2017-09-24 03:56:57 -0700 |
|---|---|---|
| committer | Keith Yeung <kungfukeith11@gmail.com> | 2017-09-26 22:20:53 -0700 |
| commit | 6d4989b821632086c7a84c36eedc8f55d1c878a4 (patch) | |
| tree | fdc300d7fecdf4402294597de96a33c254232226 /src/test/compile-fail | |
| parent | f71b37bc28326e272a37b938e835d4f99113eec2 (diff) | |
| download | rust-6d4989b821632086c7a84c36eedc8f55d1c878a4.tar.gz rust-6d4989b821632086c7a84c36eedc8f55d1c878a4.zip | |
Add span label to E0384 for MIR borrowck
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs index c219b7c5424..3639db5cfc4 100644 --- a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs +++ b/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Zemit-end-regions -Zborrowck-mir + // Test that immutable pattern bindings cannot be reassigned. #![feature(slice_patterns)] @@ -23,31 +26,41 @@ struct S { pub fn main() { match 1 { x => { - x += 1; //~ ERROR re-assignment of immutable variable `x` + x += 1; //[ast]~ ERROR re-assignment of immutable variable `x` + //[mir]~^ ERROR (Mir) [E0384] + //[mir]~| ERROR (Ast) [E0384] } } match E::Foo(1) { E::Foo(x) => { - x += 1; //~ ERROR re-assignment of immutable variable `x` + x += 1; //[ast]~ ERROR re-assignment of immutable variable `x` + //[mir]~^ ERROR (Mir) [E0384] + //[mir]~| ERROR (Ast) [E0384] } } match (S { bar: 1 }) { S { bar: x } => { - x += 1; //~ ERROR re-assignment of immutable variable `x` + x += 1; //[ast]~ ERROR re-assignment of immutable variable `x` + //[mir]~^ ERROR (Mir) [E0384] + //[mir]~| ERROR (Ast) [E0384] } } match (1,) { (x,) => { - x += 1; //~ ERROR re-assignment of immutable variable `x` + x += 1; //[ast]~ ERROR re-assignment of immutable variable `x` + //[mir]~^ ERROR (Mir) [E0384] + //[mir]~| ERROR (Ast) [E0384] } } match [1,2,3] { [x,_,_] => { - x += 1; //~ ERROR re-assignment of immutable variable `x` + x += 1; //[ast]~ ERROR re-assignment of immutable variable `x` + //[mir]~^ ERROR (Mir) [E0384] + //[mir]~| ERROR (Ast) [E0384] } } } |
