diff options
| author | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-12-07 20:48:12 +0200 |
|---|---|---|
| committer | Ariel Ben-Yehuda <ariel.byd@gmail.com> | 2017-12-10 17:46:31 +0200 |
| commit | b64ddecae8112ca41d9a37ed8a3ebfd388b7e453 (patch) | |
| tree | f5bac209b527bc063497be670f52d74cfb9a3aee /src/test | |
| parent | 97c58ed66ca20e849db0dc3942fb9735819909fd (diff) | |
use `places_conflict` to handle reassignment
This fixes the handling of reassignment of struct fields.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/immut-function-arguments.rs | 9 | ||||
| -rw-r--r-- | src/test/compile-fail/mutable-class-fields.rs | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/compile-fail/immut-function-arguments.rs index 949c1c0d9c4..b32056fcb91 100644 --- a/src/test/compile-fail/immut-function-arguments.rs +++ b/src/test/compile-fail/immut-function-arguments.rs @@ -8,14 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir fn f(y: Box<isize>) { - *y = 5; //~ ERROR cannot assign + *y = 5; //[ast]~ ERROR cannot assign + //[mir]~^ ERROR cannot assign twice } fn g() { - let _frob = |q: Box<isize>| { *q = 2; }; //~ ERROR cannot assign - + let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign + //[mir]~^ ERROR cannot assign twice } fn main() {} diff --git a/src/test/compile-fail/mutable-class-fields.rs b/src/test/compile-fail/mutable-class-fields.rs index c163dc2b4d2..f138ae93f71 100644 --- a/src/test/compile-fail/mutable-class-fields.rs +++ b/src/test/compile-fail/mutable-class-fields.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: -Z borrowck=mir + struct cat { meows : usize, how_hungry : isize, @@ -22,5 +25,6 @@ fn cat(in_x : usize, in_y : isize) -> cat { fn main() { let nyan : cat = cat(52, 99); - nyan.how_hungry = 0; //~ ERROR cannot assign + nyan.how_hungry = 0; //[ast]~ ERROR cannot assign + //[mir]~^ ERROR cannot assign } |
