diff options
Diffstat (limited to 'src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs')
| -rw-r--r-- | src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs index 4c50caf4976..3a4c22eb139 100644 --- a/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs +++ b/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.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 + use std::ops::{Index, IndexMut}; struct Foo { @@ -57,12 +60,15 @@ fn main() { let mut s = "hello".to_string(); let rs = &mut s; println!("{}", f[&s]); - //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable + //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable + //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable f[&s] = 10; - //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable + //[ast]~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable + //[mir]~^^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable let s = Bar { x: 1, }; s[2] = 20; - //~^ ERROR cannot assign to immutable indexed content + //[ast]~^ ERROR cannot assign to immutable indexed content + //[mir]~^^ ERROR cannot assign to immutable item } |
