about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBasile Desloges <basile.desloges@gmail.com>2017-09-26 21:56:37 +0200
committerBasile Desloges <basile.desloges@gmail.com>2017-09-26 21:56:37 +0200
commitb683538ef233bf67fec1b8fc48778b13047e536c (patch)
tree5d98fdfa6ab1a728cf2d85957300d4020fe9f45a
parente28c73d71fd9a31de37daf45c086e2a8b05ec05c (diff)
downloadrust-b683538ef233bf67fec1b8fc48778b13047e536c.tar.gz
rust-b683538ef233bf67fec1b8fc48778b13047e536c.zip
mir-borrowck: Edit compile-fail tests with E0506 error to also test on MIR borrowck
-rw-r--r--src/test/compile-fail/E0506.rs7
-rw-r--r--src/test/compile-fail/borrowck/borrowck-assign-comp.rs15
-rw-r--r--src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs36
-rw-r--r--src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs7
-rw-r--r--src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs7
-rw-r--r--src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs7
-rw-r--r--src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs7
-rw-r--r--src/test/compile-fail/borrowck/borrowck-union-borrow.rs50
-rw-r--r--src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs7
-rw-r--r--src/test/compile-fail/coerce-overloaded-autoderef.rs19
-rw-r--r--src/test/compile-fail/hrtb-identity-fn-borrows.rs7
-rw-r--r--src/test/compile-fail/mut-pattern-internal-mutability.rs11
-rw-r--r--src/test/compile-fail/regions-pattern-typing-issue-19997.rs7
13 files changed, 150 insertions, 37 deletions
diff --git a/src/test/compile-fail/E0506.rs b/src/test/compile-fail/E0506.rs
index ddaffd4a273..b2cf66849c7 100644
--- a/src/test/compile-fail/E0506.rs
+++ b/src/test/compile-fail/E0506.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 emit-end-regions -Z borrowck-mir
+
 struct FancyNum {
     num: u8,
 }
@@ -15,7 +18,9 @@ struct FancyNum {
 fn main() {
     let mut fancy_num = FancyNum { num: 5 };
     let fancy_ref = &fancy_num;
-    fancy_num = FancyNum { num: 6 }; //~ ERROR E0506
+    fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
+                                     //[mir]~^ ERROR (Mir) [E0506]
+                                     //[mir]~| ERROR (Ast) [E0506]
 
     println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
 }
diff --git a/src/test/compile-fail/borrowck/borrowck-assign-comp.rs b/src/test/compile-fail/borrowck/borrowck-assign-comp.rs
index 802b83119b7..e63de3a3bed 100644
--- a/src/test/compile-fail/borrowck/borrowck-assign-comp.rs
+++ b/src/test/compile-fail/borrowck/borrowck-assign-comp.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 emit-end-regions -Z borrowck-mir
+
 struct point { x: isize, y: isize }
 
 fn a() {
@@ -17,7 +20,9 @@ fn a() {
     // This assignment is illegal because the field x is not
     // inherently mutable; since `p` was made immutable, `p.x` is now
     // immutable.  Otherwise the type of &_q.x (&isize) would be wrong.
-    p.x = 5; //~ ERROR cannot assign to `p.x`
+    p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
+             //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed (Ast)
+             //[mir]~| ERROR cannot assign to `p.0` because it is borrowed (Mir)
     q.x;
 }
 
@@ -27,7 +32,9 @@ fn c() {
 
     let mut p = point {x: 3, y: 4};
     let q = &p.y;
-    p = point {x: 5, y: 7};//~ ERROR cannot assign to `p`
+    p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
+                           //[mir]~^ ERROR cannot assign to `p` because it is borrowed (Ast)
+                           //[mir]~| ERROR cannot assign to `p` because it is borrowed (Mir)
     p.x; // silence warning
     *q; // stretch loan
 }
@@ -38,7 +45,9 @@ fn d() {
 
     let mut p = point {x: 3, y: 4};
     let q = &p.y;
-    p.y = 5; //~ ERROR cannot assign to `p.y`
+    p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
+             //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed (Ast)
+             //[mir]~| ERROR cannot assign to `p.1` because it is borrowed (Mir)
     *q;
 }
 
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs
index aaa07661215..6c003ec2d48 100644
--- a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs
+++ b/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs
@@ -11,6 +11,10 @@
 // Tests that two closures cannot simultaneously have mutable
 // and immutable access to the variable. Issue #6801.
 
+// ignore-tidy-linelength
+// revisions: ast mir
+//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
+
 #![feature(box_syntax)]
 
 fn get(x: &isize) -> isize {
@@ -24,37 +28,49 @@ fn set(x: &mut isize) {
 fn a() {
     let mut x = 3;
     let c1 = || x = 4;
-    let c2 = || x * 5; //~ ERROR cannot borrow `x`
+    let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+                       //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast)
+                       //[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir)
 }
 
 fn b() {
     let mut x = 3;
     let c1 = || set(&mut x);
-    let c2 = || get(&x); //~ ERROR cannot borrow `x`
+    let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
+                         //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast)
+                         //[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir)
 }
 
 fn c() {
     let mut x = 3;
     let c1 = || set(&mut x);
-    let c2 = || x * 5; //~ ERROR cannot borrow `x`
+    let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+                       //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast)
+                       //[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir)
 }
 
 fn d() {
     let mut x = 3;
     let c2 = || x * 5;
-    x = 5; //~ ERROR cannot assign
+    x = 5; //[ast]~ ERROR cannot assign
+           //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
+           //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
 }
 
 fn e() {
     let mut x = 3;
     let c1 = || get(&x);
-    x = 5; //~ ERROR cannot assign
+    x = 5; //[ast]~ ERROR cannot assign
+           //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
+           //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
 }
 
 fn f() {
     let mut x: Box<_> = box 3;
     let c1 = || get(&*x);
-    *x = 5; //~ ERROR cannot assign
+    *x = 5; //[ast]~ ERROR cannot assign
+            //[mir]~^ ERROR cannot assign to `*x` because it is borrowed (Ast)
+            //[mir]~| ERROR cannot assign to `(*x)` because it is borrowed (Mir)
 }
 
 fn g() {
@@ -64,7 +80,9 @@ fn g() {
 
     let mut x: Box<_> = box Foo { f: box 3 };
     let c1 = || get(&*x.f);
-    *x.f = 5; //~ ERROR cannot assign to `*x.f`
+    *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
+              //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed (Ast)
+              //[mir]~| ERROR cannot assign to `(*(*x).0)` because it is borrowed (Mir)
 }
 
 fn h() {
@@ -74,7 +92,9 @@ fn h() {
 
     let mut x: Box<_> = box Foo { f: box 3 };
     let c1 = || get(&*x.f);
-    let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable
+    let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
+                          //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable (Ast)
+                          //[mir]~| ERROR cannot borrow `x` as mutable because it is also borrowed as immutable (Mir)
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
index 8af10231921..03b6b1d7324 100644
--- a/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
+++ b/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.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 mut _a = 3;
     let _b = &mut _a;
     {
         let _c = &*_b;
-        _a = 4; //~ ERROR cannot assign to `_a`
+        _a = 4; //[ast]~ ERROR cannot assign to `_a`
+                //[mir]~^ ERROR cannot assign to `_a` because it is borrowed (Ast)
+                //[mir]~| ERROR cannot assign to `_a` because it is borrowed (Mir)
     }
 }
diff --git a/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs
index f24e82d11c5..0e8c003e408 100644
--- a/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs
+++ b/src/test/compile-fail/borrowck/borrowck-lend-flow-match.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 emit-end-regions -Z borrowck-mir
+
 #![allow(unused_variables)]
 #![allow(unused_assignments)]
 
@@ -22,7 +25,9 @@ fn separate_arms() {
             x = Some(0);
         }
         Some(ref __isize) => {
-            x = Some(1); //~ ERROR cannot assign
+            x = Some(1); //[ast]~ ERROR cannot assign
+                         //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
+                         //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
         }
     }
     x.clone(); // just to prevent liveness warnings
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
index bee56c9bf39..9b20cd470f6 100644
--- a/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
+++ b/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
@@ -13,6 +13,9 @@
 // operator. The accounting of the all the implicit things going on
 // here is rather subtle. Issue #20232.
 
+// revisions: ast mir
+//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
+
 use std::ops::{Deref, Index};
 
 struct MyVec<T> { x: T }
@@ -39,7 +42,9 @@ fn main() {
     let mut v = MyVec { x: MyPtr { x: Foo { f: 22 } } };
     let i = &v[0].f;
     v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
-    //~^ ERROR cannot assign to `v`
+    //[ast]~^ ERROR cannot assign to `v`
+    //[mir]~^^ ERROR cannot assign to `v` because it is borrowed (Ast)
+    //[mir]~| ERROR cannot assign to `v` because it is borrowed (Mir)
     read(*i);
 }
 
diff --git a/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs b/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs
index d176245823e..06bb98fa0ec 100644
--- a/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs
+++ b/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.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 emit-end-regions -Z borrowck-mir
+
 fn main() {
     let mut x: Option<isize> = None;
     match x {
@@ -17,7 +20,9 @@ fn main() {
       }
       Some(ref i) => {
           // But on this branch, `i` is an outstanding borrow
-          x = Some(*i+1); //~ ERROR cannot assign to `x`
+          x = Some(*i+1); //[ast]~ ERROR cannot assign to `x`
+                          //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
+                          //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
       }
     }
     x.clone(); // just to prevent liveness warnings
diff --git a/src/test/compile-fail/borrowck/borrowck-union-borrow.rs b/src/test/compile-fail/borrowck/borrowck-union-borrow.rs
index 20b882e1f80..73d323ea82c 100644
--- a/src/test/compile-fail/borrowck/borrowck-union-borrow.rs
+++ b/src/test/compile-fail/borrowck/borrowck-union-borrow.rs
@@ -9,6 +9,8 @@
 // except according to those terms.
 
 // ignore-tidy-linelength
+// revisions: ast mir
+//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
 
 #[derive(Clone, Copy)]
 union U {
@@ -30,11 +32,15 @@ fn main() {
         }
         {
             let ra = &u.a;
-            let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+            let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+                                //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable (Ast)
+                                //[mir]~| ERROR cannot borrow `u.0` as mutable because it is also borrowed as immutable (Mir)
         }
         {
             let ra = &u.a;
-            u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed
+            u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+                     //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed (Ast)
+                     //[mir]~| ERROR cannot assign to `u.0` because it is borrowed (Mir)
         }
         // Imm borrow, other field
         {
@@ -47,45 +53,65 @@ fn main() {
         }
         {
             let ra = &u.a;
-            let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+            let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+                                //[mir]~^ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) (Ast)
+                                // FIXME Error for MIR (needs support for union)
         }
         {
             let ra = &u.a;
-            u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed
+            u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+                     //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed (Ast)
+                     // FIXME Error for MIR (needs support for union)
         }
         // Mut borrow, same field
         {
             let rma = &mut u.a;
-            let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+            let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+                         //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable (Ast)
+                         //[mir]~| ERROR cannot borrow `u.0` as immutable because it is also borrowed as mutable (Mir)
         }
         {
             let ra = &mut u.a;
-            let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed
+            let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+                         //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed (Ast)
+                         //[mir]~| ERROR cannot use `u.0` because it was mutably borrowed (Mir)
         }
         {
             let rma = &mut u.a;
-            let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time
+            let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
+                                 //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time (Ast)
+                                 //[mir]~| ERROR cannot borrow `u.0` as mutable more than once at a time (Mir)
         }
         {
             let rma = &mut u.a;
-            u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed
+            u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+                     //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed (Ast)
+                     //[mir]~| ERROR cannot assign to `u.0` because it is borrowed (Mir)
         }
         // Mut borrow, other field
         {
             let rma = &mut u.a;
-            let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+            let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+                           //[mir]~^ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) (Ast)
+                           // FIXME Error for MIR (needs support for union)
         }
         {
             let ra = &mut u.a;
-            let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed
+            let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
+                         //[mir]~^ ERROR cannot use `u.b` because it was mutably borrowed (Ast)
+                         // FIXME Error for MIR (needs support for union)
         }
         {
             let rma = &mut u.a;
-            let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
+            let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
+                                 //[mir]~^ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time (Ast)
+                                 // FIXME Error for MIR (needs support for union)
         }
         {
             let rma = &mut u.a;
-            u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed
+            u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+                     //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed (Ast)
+                     // FIXME Error for MIR (needs support for union)
         }
     }
 }
diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs b/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs
index fddb9838c44..b5916584930 100644
--- a/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs
+++ b/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.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 emit-end-regions -Z borrowck-mir
+
 #![feature(slice_patterns)]
 
 fn main() {
@@ -17,7 +20,9 @@ fn main() {
         _ => unreachable!()
     };
     println!("t[0]: {}", t[0]);
-    a[2] = 0; //~ ERROR cannot assign to `a[..]` because it is borrowed
+    a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
+              //[mir]~^ ERROR cannot assign to `a[..]` because it is borrowed (Ast)
+              // FIXME Error for MIR (error missed)
     println!("t[0]: {}", t[0]);
     t[0];
 }
diff --git a/src/test/compile-fail/coerce-overloaded-autoderef.rs b/src/test/compile-fail/coerce-overloaded-autoderef.rs
index 14fbc34c43b..43b771ce5db 100644
--- a/src/test/compile-fail/coerce-overloaded-autoderef.rs
+++ b/src/test/compile-fail/coerce-overloaded-autoderef.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 emit-end-regions -Z borrowck-mir
+
 fn borrow_mut<T>(x: &mut T) -> &mut T { x }
 fn borrow<T>(x: &T) -> &T { x }
 
@@ -17,24 +20,32 @@ fn borrow2<T>(_: &mut T, _: &T) {}
 fn double_mut_borrow<T>(x: &mut Box<T>) {
     let y = borrow_mut(x);
     let z = borrow_mut(x);
-    //~^ ERROR cannot borrow `*x` as mutable more than once at a time
+    //[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)
 }
 
 fn double_imm_borrow(x: &mut Box<i32>) {
     let y = borrow(x);
     let z = borrow(x);
     **x += 1;
-    //~^ ERROR cannot assign to `**x` because it is borrowed
+    //[ast]~^ ERROR cannot assign to `**x` because it is borrowed
+    //[mir]~^^ ERROR cannot assign to `**x` because it is borrowed (Ast)
+    //[mir]~| ERROR cannot assign to `(*(*x))` because it is borrowed (Mir)
 }
 
 fn double_mut_borrow2<T>(x: &mut Box<T>) {
     borrow_mut2(x, x);
-    //~^ ERROR cannot borrow `*x` as mutable more than once at a time
+    //[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)
 }
 
 fn double_borrow2<T>(x: &mut Box<T>) {
     borrow2(x, x);
-    //~^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable
+    //[ast]~^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable
+    //[mir]~^^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable (Ast)
+    //[mir]~| ERROR cannot borrow `(*x)` as immutable because it is also borrowed as mutable (Mir)
 }
 
 pub fn main() {}
diff --git a/src/test/compile-fail/hrtb-identity-fn-borrows.rs b/src/test/compile-fail/hrtb-identity-fn-borrows.rs
index 17939cf9fe0..b6216ce0589 100644
--- a/src/test/compile-fail/hrtb-identity-fn-borrows.rs
+++ b/src/test/compile-fail/hrtb-identity-fn-borrows.rs
@@ -11,6 +11,9 @@
 // Test that the `'a` in the where clause correctly links the region
 // of the output to the region of the input.
 
+// revisions: ast mir
+//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
+
 trait FnLike<A,R> {
     fn call(&self, arg: A) -> R;
 }
@@ -21,7 +24,9 @@ fn call_repeatedly<F>(f: F)
     // Result is stored: cannot re-assign `x`
     let mut x = 3;
     let y = f.call(&x);
-    x = 5; //~ ERROR cannot assign
+    x = 5; //[ast]~ ERROR cannot assign
+           //[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
+           //[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
 
     // Result is not stored: can re-assign `x`
     let mut x = 3;
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)
 }
diff --git a/src/test/compile-fail/regions-pattern-typing-issue-19997.rs b/src/test/compile-fail/regions-pattern-typing-issue-19997.rs
index ae9ceb600d4..91f5f048bc1 100644
--- a/src/test/compile-fail/regions-pattern-typing-issue-19997.rs
+++ b/src/test/compile-fail/regions-pattern-typing-issue-19997.rs
@@ -8,13 +8,18 @@
 // 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 a0 = 0;
     let f = 1;
     let mut a1 = &a0;
     match (&a1,) {
         (&ref b0,) => {
-            a1 = &f; //~ ERROR cannot assign
+            a1 = &f; //[ast]~ ERROR cannot assign
+                     //[mir]~^ ERROR cannot assign to `a1` because it is borrowed (Ast)
+                     //[mir]~| ERROR cannot assign to `a1` because it is borrowed (Mir)
         }
     }
 }