about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-06 09:20:31 +0000
committerbors <bors@rust-lang.org>2018-11-06 09:20:31 +0000
commitf90aab7aa9bb5834b340eaef0326994e5e09b933 (patch)
tree512ae3004f0e3c52b761bf370beec7c72f68d3ba /src/test
parent24e66c28980442a48d9458f1a4f9b76cc722dc8a (diff)
parent8589ca08b1006feb8b1bd89d87669024509bab81 (diff)
downloadrust-f90aab7aa9bb5834b340eaef0326994e5e09b933.tar.gz
rust-f90aab7aa9bb5834b340eaef0326994e5e09b933.zip
Auto merge of #55710 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #55490 (resolve: Fix ICE in macro import error recovery)
 - #55597 (std: Enable usage of `thread_local!` through imports)
 - #55601 (Fix tracking issue numbers for some unstable features)
 - #55621 (Add precision for create_dir function)
 - #55644 (ci: Add Dockerfile for dist-powerpcspe-linux)
 - #55664 (Make "all possible cases" help message uniform with existing help messages)
 - #55689 (miri: binary_op_val -> binary_op_imm)
 - #55694 (Fixes #31076)
 - #55696 (NLL Diagnostic Review 3: Missing errors for borrows of union fields)
 - #55700 (Update ui tests with respect to NLL)
 - #55703 (Update `configure --help` (via configure.py) to reflect decoupling of debug+optimize)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make/wasm-symbols-not-imported/foo.rs4
-rw-r--r--src/test/run-pass/thread-local-not-in-prelude.rs (renamed from src/test/ui/panic-implementation/panic-implementation-deprecated.rs)14
-rw-r--r--src/test/ui/binop/binop-move-semantics.nll.stderr27
-rw-r--r--src/test/ui/binop/binop-move-semantics.rs7
-rw-r--r--src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr33
-rw-r--r--src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs5
-rw-r--r--src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr30
-rw-r--r--src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr18
-rw-r--r--src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs20
-rw-r--r--src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr18
-rw-r--r--src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr (renamed from src/test/ui/borrowck/borrowck-lend-flow-loop.stderr)22
-rw-r--r--src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr10
-rw-r--r--src/test/ui/borrowck/borrowck-lend-flow-loop.rs50
-rw-r--r--src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr14
-rw-r--r--src/test/ui/borrowck/borrowck-overloaded-call.rs4
-rw-r--r--src/test/ui/borrowck/borrowck-overloaded-call.stderr1
-rw-r--r--src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr29
-rw-r--r--src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs4
-rw-r--r--src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr109
-rw-r--r--src/test/ui/borrowck/borrowck-reborrow-from-mut.rs35
-rw-r--r--src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr10
-rw-r--r--src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr14
-rw-r--r--src/test/ui/borrowck/borrowck-unboxed-closures.rs4
-rw-r--r--src/test/ui/borrowck/borrowck-unboxed-closures.stderr1
-rw-r--r--src/test/ui/codemap_tests/overlapping_spans.nll.stderr17
-rw-r--r--src/test/ui/codemap_tests/overlapping_spans.rs23
-rw-r--r--src/test/ui/codemap_tests/overlapping_spans.stderr12
-rw-r--r--src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr (renamed from src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr)2
-rw-r--r--src/test/ui/dropck/dropck-eyepatch-extern-crate.rs35
-rw-r--r--src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr (renamed from src/test/ui/dropck/dropck-eyepatch-reorder.stderr)2
-rw-r--r--src/test/ui/dropck/dropck-eyepatch-reorder.rs35
-rw-r--r--src/test/ui/dropck/dropck-eyepatch.ast.stderr (renamed from src/test/ui/dropck/dropck-eyepatch.stderr)2
-rw-r--r--src/test/ui/dropck/dropck-eyepatch.rs35
-rw-r--r--src/test/ui/error-codes/E0004-2.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-allow_fail.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr18
-rw-r--r--src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-nll.nll.stderr13
-rw-r--r--src/test/ui/feature-gates/feature-gate-nll.rs22
-rw-r--r--src/test/ui/feature-gates/feature-gate-panic-implementation.rs21
-rw-r--r--src/test/ui/feature-gates/feature-gate-panic-implementation.stderr11
-rw-r--r--src/test/ui/imports/issue-55457.rs8
-rw-r--r--src/test/ui/imports/issue-55457.stderr31
-rw-r--r--src/test/ui/issues/issue-17263.ast.stderr (renamed from src/test/ui/issues/issue-17263.stderr)2
-rw-r--r--src/test/ui/issues/issue-17263.nll.stderr6
-rw-r--r--src/test/ui/issues/issue-17263.rs38
-rw-r--r--src/test/ui/issues/issue-3096-1.stderr2
-rw-r--r--src/test/ui/issues/issue-3096-2.stderr2
-rw-r--r--src/test/ui/issues/issue-31076.rs17
-rw-r--r--src/test/ui/issues/issue-31076.stderr19
-rw-r--r--src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr6
-rw-r--r--src/test/ui/issues/issue-52126-assign-op-invariance.rs4
-rw-r--r--src/test/ui/panic-implementation/panic-implementation-deprecated.stderr14
-rw-r--r--src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr25
-rw-r--r--src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs6
-rw-r--r--src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr2
-rw-r--r--src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr6
-rw-r--r--src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr47
-rw-r--r--src/test/ui/union/union-borrow-move-parent-sibling.rs17
-rw-r--r--src/test/ui/union/union-borrow-move-parent-sibling.stderr27
-rw-r--r--src/test/ui/unop-move-semantics.nll.stderr27
-rw-r--r--src/test/ui/unop-move-semantics.rs7
63 files changed, 695 insertions, 357 deletions
diff --git a/src/test/run-make/wasm-symbols-not-imported/foo.rs b/src/test/run-make/wasm-symbols-not-imported/foo.rs
index 156db486a47..dcc2f4f5223 100644
--- a/src/test/run-make/wasm-symbols-not-imported/foo.rs
+++ b/src/test/run-make/wasm-symbols-not-imported/foo.rs
@@ -9,8 +9,6 @@
 // except according to those terms.
 
 #![crate_type = "cdylib"]
-
-#![feature(panic_implementation)]
 #![no_std]
 
 use core::panic::PanicInfo;
@@ -20,7 +18,7 @@ pub extern fn foo() {
     panic!()
 }
 
-#[panic_implementation]
+#[panic_handler]
 fn panic(_info: &PanicInfo) -> ! {
     loop {}
 }
diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.rs b/src/test/run-pass/thread-local-not-in-prelude.rs
index c4bec01f6af..0c365597b82 100644
--- a/src/test/ui/panic-implementation/panic-implementation-deprecated.rs
+++ b/src/test/run-pass/thread-local-not-in-prelude.rs
@@ -8,17 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-C panic=abort
-
-#![deny(deprecated)]
-#![feature(panic_implementation)]
 #![no_std]
 
-use core::panic::PanicInfo;
+extern crate std;
 
-#[panic_implementation]
-fn panic(info: &PanicInfo) -> ! {
-    loop {}
-}
+std::thread_local!(static A: usize = 30);
 
-fn main() {}
+fn main() {
+}
diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr
index 545a60f6770..612375f9047 100644
--- a/src/test/ui/binop/binop-move-semantics.nll.stderr
+++ b/src/test/ui/binop/binop-move-semantics.nll.stderr
@@ -20,6 +20,29 @@ LL |     x.clone();  //~ ERROR: use of moved value
    |
    = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
 
+error[E0505]: cannot move out of `x` because it is borrowed
+  --> $DIR/binop-move-semantics.rs:31:5
+   |
+LL |     let m = &x;
+   |             -- borrow of `x` occurs here
+...
+LL |     x  //~ ERROR: cannot move out of `x` because it is borrowed
+   |     ^ move out of `x` occurs here
+...
+LL |     use_mut(n); use_imm(m);
+   |                         - borrow later used here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/binop-move-semantics.rs:33:5
+   |
+LL |     let n = &mut y;
+   |             ------ borrow of `y` occurs here
+...
+LL |     y;  //~ ERROR: cannot move out of `y` because it is borrowed
+   |     ^ move out of `y` occurs here
+LL |     use_mut(n); use_imm(m);
+   |             - borrow later used here
+
 error[E0507]: cannot move out of borrowed content
   --> $DIR/binop-move-semantics.rs:40:5
    |
@@ -62,7 +85,7 @@ LL | |     &mut f;  //~ ERROR: cannot borrow `f` as mutable because it is also b
    |       |    immutable borrow later used here
    |       mutable borrow occurs here
 
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
 
-Some errors occurred: E0382, E0502, E0507.
+Some errors occurred: E0382, E0502, E0505, E0507.
 For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/binop/binop-move-semantics.rs b/src/test/ui/binop/binop-move-semantics.rs
index cff0064497a..f6fad8b46dd 100644
--- a/src/test/ui/binop/binop-move-semantics.rs
+++ b/src/test/ui/binop/binop-move-semantics.rs
@@ -31,8 +31,8 @@ fn move_borrowed<T: Add<Output=()>>(x: T, mut y: T) {
     x  //~ ERROR: cannot move out of `x` because it is borrowed
     +
     y;  //~ ERROR: cannot move out of `y` because it is borrowed
+    use_mut(n); use_imm(m);
 }
-
 fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
     let m = &mut x;
     let n = &y;
@@ -40,8 +40,8 @@ fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
     *m  //~ ERROR: cannot move out of borrowed content
     +
     *n;  //~ ERROR: cannot move out of borrowed content
+    use_imm(n); use_mut(m);
 }
-
 struct Foo;
 
 impl<'a, 'b> Add<&'b Foo> for &'a mut Foo {
@@ -73,3 +73,6 @@ fn immut_plus_mut() {
 }
 
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
index e8fae63a5d6..160a84c480c 100644
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
@@ -1,15 +1,32 @@
 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
-  --> $DIR/borrowck-closures-mut-of-imm.rs:23:21
+  --> $DIR/borrowck-closures-mut-of-imm.rs:23:25
    |
-LL |     let c1 = || set(&mut *x);
-   |                     ^^^^^^^ cannot borrow as mutable
+LL |     let mut c1 = || set(&mut *x);
+   |                         ^^^^^^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
-  --> $DIR/borrowck-closures-mut-of-imm.rs:25:21
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:25
    |
-LL |     let c2 = || set(&mut *x);
-   |                     ^^^^^^^ cannot borrow as mutable
+LL |     let mut c2 = || set(&mut *x);
+   |                         ^^^^^^^ cannot borrow as mutable
 
-error: aborting due to 2 previous errors
+error[E0524]: two closures require unique access to `x` at the same time
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:18
+   |
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - first borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
+LL |     //~^ ERROR cannot borrow
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - second borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
+...
+LL |     c2(); c1();
+   |           -- first borrow later used here
+
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0596`.
+Some errors occurred: E0524, E0596.
+For more information about an error, try `rustc --explain E0524`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs
index dc2f0e8395f..3bf4f17fde1 100644
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs
@@ -20,11 +20,12 @@ fn set(x: &mut isize) {
 }
 
 fn a(x: &isize) {
-    let c1 = || set(&mut *x);
+    let mut c1 = || set(&mut *x);
     //~^ ERROR cannot borrow
-    let c2 = || set(&mut *x);
+    let mut c2 = || set(&mut *x);
     //~^ ERROR cannot borrow
     //~| ERROR two closures require unique access to `x` at the same time
+    c2(); c1();
 }
 
 fn main() {
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
index 87eb52b6aa6..c248595d571 100644
--- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
@@ -1,30 +1,30 @@
 error[E0524]: two closures require unique access to `x` at the same time
-  --> $DIR/borrowck-closures-mut-of-imm.rs:25:14
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:18
    |
-LL |     let c1 = || set(&mut *x);
-   |              --           - previous borrow occurs due to use of `x` in closure
-   |              |
-   |              first closure is constructed here
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - previous borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
 LL |     //~^ ERROR cannot borrow
-LL |     let c2 = || set(&mut *x);
-   |              ^^           - borrow occurs due to use of `x` in closure
-   |              |
-   |              second closure is constructed here
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
 ...
 LL | }
    | - borrow from first closure ends here
 
 error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
-  --> $DIR/borrowck-closures-mut-of-imm.rs:23:26
+  --> $DIR/borrowck-closures-mut-of-imm.rs:23:30
    |
-LL |     let c1 = || set(&mut *x);
-   |                          ^^ cannot borrow as mutable
+LL |     let mut c1 = || set(&mut *x);
+   |                              ^^ cannot borrow as mutable
 
 error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
-  --> $DIR/borrowck-closures-mut-of-imm.rs:25:26
+  --> $DIR/borrowck-closures-mut-of-imm.rs:25:30
    |
-LL |     let c2 = || set(&mut *x);
-   |                          ^^ cannot borrow as mutable
+LL |     let mut c2 = || set(&mut *x);
+   |                              ^^ cannot borrow as mutable
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr
new file mode 100644
index 00000000000..18f95f232cd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr
@@ -0,0 +1,18 @@
+error[E0524]: two closures require unique access to `x` at the same time
+  --> $DIR/borrowck-closures-mut-of-mut.rs:14:18
+   |
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - first borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - second borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
+LL |     //~^ ERROR two closures require unique access to `x` at the same time
+LL |     c2(); c1();
+   |           -- first borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0524`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs
new file mode 100644
index 00000000000..50c6f2c585e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.rs
@@ -0,0 +1,20 @@
+// Tests that two closures cannot simultaneously both have mutable
+// access to the variable. Related to issue #6801.
+
+fn get(x: &isize) -> isize {
+    *x
+}
+
+fn set(x: &mut isize) {
+    *x = 4;
+}
+
+fn a(x: &mut isize) {
+    let mut c1 = || set(&mut *x);
+    let mut c2 = || set(&mut *x);
+    //~^ ERROR two closures require unique access to `x` at the same time
+    c2(); c1();
+}
+
+fn main() {
+}
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr
new file mode 100644
index 00000000000..2c5587710a1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.stderr
@@ -0,0 +1,18 @@
+error[E0524]: two closures require unique access to `x` at the same time
+  --> $DIR/borrowck-closures-mut-of-mut.rs:14:18
+   |
+LL |     let mut c1 = || set(&mut *x);
+   |                  --           - previous borrow occurs due to use of `x` in closure
+   |                  |
+   |                  first closure is constructed here
+LL |     let mut c2 = || set(&mut *x);
+   |                  ^^           - borrow occurs due to use of `x` in closure
+   |                  |
+   |                  second closure is constructed here
+...
+LL | }
+   | - borrow from first closure ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0524`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr
index 534e30b564d..1844d827599 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.ast.stderr
@@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mu
 LL |     let mut x = &mut v;
    |                      - mutable borrow occurs here
 ...
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                 ^^ immutable borrow occurs here
 LL |     }
 LL | }
@@ -16,7 +16,7 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mu
 LL |     let mut x = &mut v;
    |                      - mutable borrow occurs here
 LL |     for _ in 0..3 {
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                 ^^ immutable borrow occurs here
 ...
 LL | }
@@ -25,7 +25,7 @@ LL | }
 error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
   --> $DIR/borrowck-lend-flow-loop.rs:57:25
    |
-LL |         borrow_mut(&mut *v); //~ ERROR cannot borrow
+LL |         borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
    |                         ^^ mutable borrow occurs here
 LL |         _x = &v;
    |               - immutable borrow occurs here
@@ -36,7 +36,7 @@ LL | }
 error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
   --> $DIR/borrowck-lend-flow-loop.rs:69:25
    |
-LL |         borrow_mut(&mut *v); //~ ERROR cannot borrow
+LL |         borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
    |                         ^^ mutable borrow occurs here
 LL |         _x = &v;
    |               - immutable borrow occurs here
@@ -50,7 +50,7 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immu
 LL |         _x = &v;
    |               - immutable borrow occurs here
 ...
-LL |     borrow_mut(&mut *v); //~ ERROR cannot borrow
+LL |     borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
    |                     ^^ mutable borrow occurs here
 LL | }
    | - immutable borrow ends here
@@ -61,7 +61,7 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immu
 LL |         _x = &v;
    |               - immutable borrow occurs here
 ...
-LL |     borrow_mut(&mut *v); //~ ERROR cannot borrow
+LL |     borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
    |                     ^^ mutable borrow occurs here
 LL | }
    | - immutable borrow ends here
@@ -69,19 +69,19 @@ LL | }
 error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
   --> $DIR/borrowck-lend-flow-loop.rs:109:17
    |
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                 ^^ immutable borrow occurs here
-LL |         if cond2 {
-LL |             x = &mut v; //~ ERROR cannot borrow
+...
+LL |             x = &mut v; //[ast]~ ERROR cannot borrow
    |                      - mutable borrow occurs here
 ...
 LL | }
    | - mutable borrow ends here
 
 error[E0499]: cannot borrow `v` as mutable more than once at a time
-  --> $DIR/borrowck-lend-flow-loop.rs:111:22
+  --> $DIR/borrowck-lend-flow-loop.rs:112:22
    |
-LL |             x = &mut v; //~ ERROR cannot borrow
+LL |             x = &mut v; //[ast]~ ERROR cannot borrow
    |                      ^ mutable borrow starts here in previous iteration of loop
 ...
 LL | }
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
index 388fc9c5fa8..19de3582c88 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
@@ -4,9 +4,9 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut
 LL |     let mut x = &mut v;
    |                 ------ mutable borrow occurs here
 LL |     for _ in 0..3 {
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                ^^^ immutable borrow occurs here
-LL |     }
+...
 LL |     *x = box 5;
    |     -- mutable borrow used here, in later iteration of loop
 
@@ -15,10 +15,10 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut
    |
 LL |         **x += 1;
    |         -------- mutable borrow used here, in later iteration of loop
-LL |         borrow(&*v); //~ ERROR cannot borrow
+LL |         borrow(&*v); //[ast]~ ERROR cannot borrow
    |                ^^^ immutable borrow occurs here
-LL |         if cond2 {
-LL |             x = &mut v; //~ ERROR cannot borrow
+...
+LL |             x = &mut v; //[ast]~ ERROR cannot borrow
    |                 ------ mutable borrow occurs here
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.rs b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
index f09e7ffd7e4..7008e5cef4b 100644
--- a/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
@@ -1,18 +1,18 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Note: the borrowck analysis is currently flow-insensitive.
-// Therefore, some of these errors are marked as spurious and could be
-// corrected by a simple change to the analysis.  The others are
-// either genuine or would require more advanced changes.  The latter
-// cases are noted.
+// revisions: ast nll
+
+// Since we are testing nll migration explicitly as a separate
+// revision, don't worry about the --compare-mode=nll on this test.
+
+// ignore-compare-mode-nll
+
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// Note: the borrowck analysis was originally a flow-insensitive pass
+// over the AST. Therefore, some of these (AST) errors are marked as
+// spurious and are corrected by the flow-sensitive (NLL) analysis.
+// The others are either genuine or would require more advanced
+// changes. The latter cases are noted.
 
 #![feature(box_syntax)]
 
@@ -32,7 +32,7 @@ fn loop_overarching_alias_mut() {
     let mut x = &mut v;
     **x += 1;
     loop {
-        borrow(&*v); //~ ERROR cannot borrow
+        borrow(&*v); //[ast]~ ERROR cannot borrow
     }
 }
 
@@ -42,11 +42,11 @@ fn block_overarching_alias_mut() {
     let mut v: Box<_> = box 3;
     let mut x = &mut v;
     for _ in 0..3 {
-        borrow(&*v); //~ ERROR cannot borrow
+        borrow(&*v); //[ast]~ ERROR cannot borrow
+        //[nll]~^ ERROR cannot borrow
     }
     *x = box 5;
 }
-
 fn loop_aliased_mut() {
     // In this instance, the borrow is carried through the loop.
 
@@ -54,7 +54,7 @@ fn loop_aliased_mut() {
     let mut w: Box<_> = box 4;
     let mut _x = &w;
     loop {
-        borrow_mut(&mut *v); //~ ERROR cannot borrow
+        borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
         _x = &v;
     }
 }
@@ -66,7 +66,7 @@ fn while_aliased_mut() {
     let mut w: Box<_> = box 4;
     let mut _x = &w;
     while cond() {
-        borrow_mut(&mut *v); //~ ERROR cannot borrow
+        borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
         _x = &v;
     }
 }
@@ -83,7 +83,7 @@ fn loop_aliased_mut_break() {
         _x = &v;
         break;
     }
-    borrow_mut(&mut *v); //~ ERROR cannot borrow
+    borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
 }
 
 fn while_aliased_mut_break() {
@@ -97,7 +97,7 @@ fn while_aliased_mut_break() {
         _x = &v;
         break;
     }
-    borrow_mut(&mut *v); //~ ERROR cannot borrow
+    borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow
 }
 
 fn while_aliased_mut_cond(cond: bool, cond2: bool) {
@@ -106,13 +106,13 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
     let mut x = &mut w;
     while cond {
         **x += 1;
-        borrow(&*v); //~ ERROR cannot borrow
+        borrow(&*v); //[ast]~ ERROR cannot borrow
+        //[nll]~^ ERROR cannot borrow
         if cond2 {
-            x = &mut v; //~ ERROR cannot borrow
+            x = &mut v; //[ast]~ ERROR cannot borrow
         }
     }
 }
-
 fn loop_break_pops_scopes<'r, F>(_v: &'r mut [usize], mut f: F) where
     F: FnMut(&'r mut usize) -> bool,
 {
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
index dc8d731dede..0c4f2fa9d71 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
@@ -1,3 +1,13 @@
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-overloaded-call.rs:69:5
+   |
+LL |     let sp = &mut s;
+   |              ------ mutable borrow occurs here
+LL |     s(3);   //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+   |     ^ immutable borrow occurs here
+LL |     use_mut(sp);
+   |             -- mutable borrow later used here
+
 error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-overloaded-call.rs:77:5
    |
@@ -17,7 +27,7 @@ LL |     s(" world".to_string());    //~ ERROR use of moved value: `s`
    |
    = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors occurred: E0382, E0596.
+Some errors occurred: E0382, E0502, E0596.
 For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.rs b/src/test/ui/borrowck/borrowck-overloaded-call.rs
index 41f3e472cd1..b2401fbbc04 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-call.rs
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.rs
@@ -67,8 +67,8 @@ fn f() {
     };
     let sp = &mut s;
     s(3);   //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+    use_mut(sp);
 }
-
 fn g() {
     let s = SFnMut {
         x: 1,
@@ -86,3 +86,5 @@ fn h() {
 }
 
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.stderr
index fa2473adc2f..bb5bafbbc7b 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-call.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.stderr
@@ -5,6 +5,7 @@ LL |     let sp = &mut s;
    |                   - mutable borrow occurs here
 LL |     s(3);   //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
    |     ^ immutable borrow occurs here
+LL |     use_mut(sp);
 LL | }
    | - mutable borrow ends here
 
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
index 824d8298ecb..198d086aa3b 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
@@ -1,3 +1,27 @@
+error[E0505]: cannot move out of `s` because it is borrowed
+  --> $DIR/borrowck-overloaded-index-move-index.rs:60:22
+   |
+LL |     let rs = &mut s;
+   |              ------ borrow of `s` occurs here
+LL | 
+LL |     println!("{}", f[s]);
+   |                      ^ move out of `s` occurs here
+...
+LL |     use_mut(rs);
+   |             -- borrow later used here
+
+error[E0505]: cannot move out of `s` because it is borrowed
+  --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
+   |
+LL |     let rs = &mut s;
+   |              ------ borrow of `s` occurs here
+...
+LL |     f[s] = 10;
+   |       ^ move out of `s` occurs here
+...
+LL |     use_mut(rs);
+   |             -- borrow later used here
+
 error[E0382]: use of moved value: `s`
   --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
    |
@@ -9,6 +33,7 @@ LL |     f[s] = 10;
    |
    = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
 
-error: aborting due to previous error
+error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0382`.
+Some errors occurred: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs
index d8615d19053..e95423a8e83 100644
--- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs
@@ -71,4 +71,8 @@ fn main() {
     let _j = &i;
     println!("{}", s[i]); // no error, i is copy
     println!("{}", s[i]);
+
+    use_mut(rs);
 }
+
+fn use_mut<T>(_: &mut T) { }
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
index 4c81bb8eb30..1b4f9e77da8 100644
--- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
@@ -1,3 +1,107 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:23:17
+   |
+LL |     let _bar1 = &mut foo.bar1;
+   |                 ------------- first mutable borrow occurs here
+LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:28:17
+   |
+LL |     let _bar1 = &mut foo.bar1;
+   |                 ------------- mutable borrow occurs here
+LL |     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- mutable borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:33:17
+   |
+LL |     let _bar1 = &foo.bar1;
+   |                 --------- immutable borrow occurs here
+LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
+   |             ----- immutable borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:55:21
+   |
+LL |     let _bar1 = &mut foo.bar1;
+   |                 ------------- first mutable borrow occurs here
+LL |     match *foo {
+LL |         Foo { bar1: ref mut _bar1, bar2: _ } => {}
+   |                     ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:62:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ mutable borrow occurs here
+LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ immutable borrow occurs here
+LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
+LL |     use_mut(_bar1);
+   |             ----- mutable borrow later used here
+
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:63:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ mutable borrow occurs here
+LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
+   |                 ^^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- mutable borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:68:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ first mutable borrow occurs here
+LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0499]: cannot borrow `*foo` as mutable more than once at a time
+  --> $DIR/borrowck-reborrow-from-mut.rs:73:17
+   |
+LL |     let _bar1 = &mut foo.bar1.int1;
+   |                 ------------------ first mutable borrow occurs here
+LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
+   |             ----- first borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:78:17
+   |
+LL |     let _bar1 = &foo.bar1.int1;
+   |                 -------------- immutable borrow occurs here
+LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
+   |             ----- immutable borrow later used here
+
+error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
+  --> $DIR/borrowck-reborrow-from-mut.rs:83:17
+   |
+LL |     let _bar1 = &foo.bar1.int1;
+   |                 -------------- immutable borrow occurs here
+LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+   |                 ^^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
+   |             ----- immutable borrow later used here
+
 error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` reference
   --> $DIR/borrowck-reborrow-from-mut.rs:98:17
    |
@@ -6,6 +110,7 @@ LL | fn borrow_mut_from_imm(foo: &Foo) {
 LL |     let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                 ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
-error: aborting due to previous error
+error: aborting due to 11 previous errors
 
-For more information about this error, try `rustc --explain E0596`.
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs b/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs
index 6f5dfa67be5..9235d900a7e 100644
--- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs
@@ -21,79 +21,79 @@ struct Bar {
 fn borrow_same_field_twice_mut_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_same_field_twice_mut_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_same_field_twice_imm_mut(foo: &mut Foo) {
     let _bar1 = &foo.bar1;
     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    use_imm(_bar1);
 }
-
 fn borrow_same_field_twice_imm_imm(foo: &mut Foo) {
     let _bar1 = &foo.bar1;
     let _bar2 = &foo.bar1;
+    use_imm(_bar1);
 }
-
 fn borrow_both_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _bar2 = &mut foo.bar2;
+    use_mut(_bar1);
 }
-
 fn borrow_both_mut_pattern(foo: &mut Foo) {
     match *foo {
-        Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
+        Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } =>
+        { use_mut(_bar1); use_mut(_bar2); }
     }
 }
-
 fn borrow_var_and_pattern(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     match *foo {
         Foo { bar1: ref mut _bar1, bar2: _ } => {}
         //~^ ERROR cannot borrow
     }
+    use_mut(_bar1);
 }
-
 fn borrow_mut_and_base_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
     let _foo2 = &*foo; //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_mut_and_base_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_mut_and_base_mut2(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+    use_mut(_bar1);
 }
-
 fn borrow_imm_and_base_mut(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    use_imm(_bar1);
 }
-
 fn borrow_imm_and_base_mut2(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
     let _foo2 = &mut *foo; //~ ERROR cannot borrow
+    use_imm(_bar1);
 }
-
 fn borrow_imm_and_base_imm(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
     let _foo1 = &foo.bar1;
     let _foo2 = &*foo;
+    use_imm(_bar1);
 }
-
 fn borrow_mut_and_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     let _foo1 = &foo.bar2;
+    use_mut(_bar1);
 }
-
 fn borrow_mut_from_imm(foo: &Foo) {
     let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
 }
@@ -101,6 +101,9 @@ fn borrow_mut_from_imm(foo: &Foo) {
 fn borrow_long_path_both_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
     let _foo1 = &mut foo.bar2.int2;
+    use_mut(_bar1);
 }
-
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
index 00660ff8484..1310e38cb3e 100644
--- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
@@ -5,6 +5,7 @@ LL |     let _bar1 = &mut foo.bar1;
    |                      -------- first mutable borrow occurs here
 LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
    |                      ^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - first borrow ends here
 
@@ -15,6 +16,7 @@ LL |     let _bar1 = &mut foo.bar1;
    |                      -------- mutable borrow occurs here
 LL |     let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
    |                  ^^^^^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - mutable borrow ends here
 
@@ -25,6 +27,7 @@ LL |     let _bar1 = &foo.bar1;
    |                  -------- immutable borrow occurs here
 LL |     let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
    |                      ^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
 LL | }
    | - immutable borrow ends here
 
@@ -47,7 +50,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
    |                      ------------- mutable borrow occurs here
 LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
    |                  ^^^^^^^^ immutable borrow occurs here
-LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
+...
 LL | }
    | - mutable borrow ends here
 
@@ -59,6 +62,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
 LL |     let _foo1 = &foo.bar1; //~ ERROR cannot borrow
 LL |     let _foo2 = &*foo; //~ ERROR cannot borrow
    |                  ^^^^ immutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - mutable borrow ends here
 
@@ -69,6 +73,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
    |                      ------------- first mutable borrow occurs here
 LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                      ^^^^^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - first borrow ends here
 
@@ -79,6 +84,7 @@ LL |     let _bar1 = &mut foo.bar1.int1;
    |                      ------------- first mutable borrow occurs here
 LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
    |                      ^^^^ second mutable borrow occurs here
+LL |     use_mut(_bar1);
 LL | }
    | - first borrow ends here
 
@@ -89,6 +95,7 @@ LL |     let _bar1 = &foo.bar1.int1;
    |                  ------------- immutable borrow occurs here
 LL |     let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
    |                      ^^^^^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
 LL | }
    | - immutable borrow ends here
 
@@ -99,6 +106,7 @@ LL |     let _bar1 = &foo.bar1.int1;
    |                  ------------- immutable borrow occurs here
 LL |     let _foo2 = &mut *foo; //~ ERROR cannot borrow
    |                      ^^^^ mutable borrow occurs here
+LL |     use_imm(_bar1);
 LL | }
    | - immutable borrow ends here
 
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
index 3fbb747db24..ee5ad58290e 100644
--- a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
@@ -1,3 +1,13 @@
+error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
+  --> $DIR/borrowck-unboxed-closures.rs:13:5
+   |
+LL |     let g = &mut f;
+   |             ------ mutable borrow occurs here
+LL |     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
+   |     ^ immutable borrow occurs here
+LL |     use_mut(g);
+   |             - mutable borrow later used here
+
 error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-unboxed-closures.rs:17:5
    |
@@ -16,7 +26,7 @@ LL |     f(1, 2);    //~ ERROR use of moved value
    |
    = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors occurred: E0382, E0596.
+Some errors occurred: E0382, E0502, E0596.
 For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.rs b/src/test/ui/borrowck/borrowck-unboxed-closures.rs
index 4813b4b6a72..43f143a492f 100644
--- a/src/test/ui/borrowck/borrowck-unboxed-closures.rs
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.rs
@@ -11,8 +11,8 @@
 fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
     let g = &mut f;
     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
+    use_mut(g);
 }
-
 fn b<F:FnMut(isize, isize) -> isize>(f: F) {
     f(1, 2);    //~ ERROR cannot borrow immutable argument
 }
@@ -23,3 +23,5 @@ fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
 }
 
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
index 0c067c47004..6ee1a6245a5 100644
--- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
@@ -5,6 +5,7 @@ LL |     let g = &mut f;
    |                  - mutable borrow occurs here
 LL |     f(1, 2);    //~ ERROR cannot borrow `f` as immutable
    |     ^ immutable borrow occurs here
+LL |     use_mut(g);
 LL | }
    | - mutable borrow ends here
 
diff --git a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr
deleted file mode 100644
index e334472f9d6..00000000000
--- a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
-  --> $DIR/overlapping_spans.rs:20:11
-   |
-LL |     match (S {f:"foo".to_string()}) {
-   |           ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
-LL |         S {f:_s} => {} //~ ERROR cannot move out
-   |              -- data moved here
-   |
-note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
-  --> $DIR/overlapping_spans.rs:21:14
-   |
-LL |         S {f:_s} => {} //~ ERROR cannot move out
-   |              ^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/codemap_tests/overlapping_spans.rs b/src/test/ui/codemap_tests/overlapping_spans.rs
deleted file mode 100644
index 467e90bd5a5..00000000000
--- a/src/test/ui/codemap_tests/overlapping_spans.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(Debug)]
-struct Foo { }
-
-struct S {f:String}
-impl Drop for S {
-    fn drop(&mut self) { println!("{}", self.f); }
-}
-
-fn main() {
-    match (S {f:"foo".to_string()}) {
-        S {f:_s} => {} //~ ERROR cannot move out
-    }
-}
diff --git a/src/test/ui/codemap_tests/overlapping_spans.stderr b/src/test/ui/codemap_tests/overlapping_spans.stderr
deleted file mode 100644
index 62a4f08e156..00000000000
--- a/src/test/ui/codemap_tests/overlapping_spans.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
-  --> $DIR/overlapping_spans.rs:21:9
-   |
-LL |         S {f:_s} => {} //~ ERROR cannot move out
-   |         ^^^^^--^
-   |         |    |
-   |         |    hint: to prevent move, use `ref _s` or `ref mut _s`
-   |         cannot move out of here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr b/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr
index 35db46f4fae..31adb2f3f14 100644
--- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
+++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.ast.stderr
@@ -32,7 +32,7 @@ LL | }
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:49:20
+  --> $DIR/dropck-eyepatch-extern-crate.rs:50:20
    |
 LL |     dr = Dr("dr", &c_shortest);
    |                    ^^^^^^^^^^ borrowed value does not live long enough
diff --git a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
index 3e531d9fd60..68065639398 100644
--- a/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
+++ b/src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
@@ -1,12 +1,12 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
+// The behavior of AST-borrowck and NLL explcitly differ here due to
+// NLL's increased precision; so we use revisions and do not worry
+// about the --compare-mode=nll on this test.
+
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// ignore-compare-mode-nll
 
 // aux-build:dropck_eyepatch_extern_crate.rs
 
@@ -39,29 +39,32 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
 
     // Error: `c_shortest` dies too soon for the references in dtors to be valid.
     dt = Dt("dt", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
+    //[nll]~^^ ERROR `c_shortest` does not live long enough
     dr = Dr("dr", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
-
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c_shortest, &c_long);
     pr = Pr("pr", &c_shortest, &c_long);
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     pr = Pr("pr", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c_shortest);
     sr = Sr("sr", &c_shortest);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
+    use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
 }
+
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr b/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr
index 9984a7b9409..ddd47e97434 100644
--- a/src/test/ui/dropck/dropck-eyepatch-reorder.stderr
+++ b/src/test/ui/dropck/dropck-eyepatch-reorder.ast.stderr
@@ -32,7 +32,7 @@ LL | }
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:66:20
+  --> $DIR/dropck-eyepatch-reorder.rs:67:20
    |
 LL |     dr = Dr("dr", &c_shortest);
    |                    ^^^^^^^^^^ borrowed value does not live long enough
diff --git a/src/test/ui/dropck/dropck-eyepatch-reorder.rs b/src/test/ui/dropck/dropck-eyepatch-reorder.rs
index 1806dc71424..16aaa261257 100644
--- a/src/test/ui/dropck/dropck-eyepatch-reorder.rs
+++ b/src/test/ui/dropck/dropck-eyepatch-reorder.rs
@@ -1,12 +1,12 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
+// The behavior of AST-borrowck and NLL explcitly differ here due to
+// NLL's increased precision; so we use revisions and do not worry
+// about the --compare-mode=nll on this test.
+
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// ignore-compare-mode-nll
 
 #![feature(dropck_eyepatch, rustc_attrs)]
 
@@ -56,29 +56,32 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
 
     // Error: `c_shortest` dies too soon for the references in dtors to be valid.
     dt = Dt("dt", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
+    //[nll]~^^ ERROR `c_shortest` does not live long enough
     dr = Dr("dr", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
-
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c_shortest, &c_long);
     pr = Pr("pr", &c_shortest, &c_long);
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     pr = Pr("pr", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c_shortest);
     sr = Sr("sr", &c_shortest);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
+    use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
 }
+
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/dropck/dropck-eyepatch.stderr b/src/test/ui/dropck/dropck-eyepatch.ast.stderr
index 7cdf645941d..0952ed0d6b7 100644
--- a/src/test/ui/dropck/dropck-eyepatch.stderr
+++ b/src/test/ui/dropck/dropck-eyepatch.ast.stderr
@@ -32,7 +32,7 @@ LL | }
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c_shortest` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:89:20
+  --> $DIR/dropck-eyepatch.rs:90:20
    |
 LL |     dr = Dr("dr", &c_shortest);
    |                    ^^^^^^^^^^ borrowed value does not live long enough
diff --git a/src/test/ui/dropck/dropck-eyepatch.rs b/src/test/ui/dropck/dropck-eyepatch.rs
index 40d3ff050e2..d7a671fd33c 100644
--- a/src/test/ui/dropck/dropck-eyepatch.rs
+++ b/src/test/ui/dropck/dropck-eyepatch.rs
@@ -1,12 +1,12 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
+// The behavior of AST-borrowck and NLL explcitly differ here due to
+// NLL's increased precision; so we use revisions and do not worry
+// about the --compare-mode=nll on this test.
+
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// ignore-compare-mode-nll
 
 #![feature(dropck_eyepatch, rustc_attrs)]
 
@@ -79,16 +79,16 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
-    //~^ ERROR `c` does not live long enough
+    //[ast]~^ ERROR `c` does not live long enough
 
     // Error: `c_shortest` dies too soon for the references in dtors to be valid.
     dt = Dt("dt", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
+    //[nll]~^^ ERROR `c_shortest` does not live long enough
     dr = Dr("dr", &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
-
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c_shortest, &c_long);
@@ -96,13 +96,16 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
     pr = Pr("pr", &c_long, &c_shortest);
-    //~^ ERROR `c_shortest` does not live long enough
+    //[ast]~^ ERROR `c_shortest` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c_shortest);
     sr = Sr("sr", &c_shortest);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
+    use_imm(sr.1); use_imm(st.1); use_imm(pr.1); use_imm(pt.1); use_imm(dr.1); use_imm(dt.1);
 }
+
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr
index 6a4392df35d..900812787bc 100644
--- a/src/test/ui/error-codes/E0004-2.stderr
+++ b/src/test/ui/error-codes/E0004-2.stderr
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empt
 LL |     match x { } //~ ERROR E0004
    |           ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/E0004-2.rs:14:11
    |
 LL |     match x { } //~ ERROR E0004
diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr
index 3f8ad32437d..736fad44b8b 100644
--- a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr
+++ b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr
@@ -1,4 +1,4 @@
-error[E0658]: allow_fail attribute is currently unstable (see issue #42219)
+error[E0658]: allow_fail attribute is currently unstable (see issue #46488)
   --> $DIR/feature-gate-allow_fail.rs:13:1
    |
 LL | #[allow_fail] //~ ERROR allow_fail attribute is currently unstable
diff --git a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr
index d0ee40504fb..e1c1dcbcd79 100644
--- a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr
+++ b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr
@@ -1,4 +1,4 @@
-error[E0658]: `crate` visibility modifier is experimental (see issue #45388)
+error[E0658]: `crate` visibility modifier is experimental (see issue #53120)
   --> $DIR/feature-gate-crate_visibility_modifier.rs:11:1
    |
 LL | crate struct Bender { //~ ERROR `crate` visibility modifier is experimental
diff --git a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr
index cabfb56d7a8..bbd4b630263 100644
--- a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr
+++ b/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr
@@ -1,4 +1,4 @@
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:26:9
    |
 LL |     use alloc;
@@ -6,7 +6,7 @@ LL |     use alloc;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:28:9
    |
 LL |     use alloc::boxed;
@@ -14,7 +14,7 @@ LL |     use alloc::boxed;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:33:11
    |
 LL |     use ::alloc;
@@ -22,7 +22,7 @@ LL |     use ::alloc;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:35:11
    |
 LL |     use ::alloc::boxed;
@@ -30,7 +30,7 @@ LL |     use ::alloc::boxed;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:9:17
    |
 LL |         let v = alloc::vec![0];
@@ -38,7 +38,7 @@ LL |         let v = alloc::vec![0];
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:11:18
    |
 LL |         type A = alloc::boxed::Box<u8>;
@@ -46,7 +46,7 @@ LL |         type A = alloc::boxed::Box<u8>;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:18:19
    |
 LL |         let v = ::alloc::vec![0];
@@ -54,7 +54,7 @@ LL |         let v = ::alloc::vec![0];
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:20:20
    |
 LL |         type A = ::alloc::boxed::Box<u8>;
@@ -62,7 +62,7 @@ LL |         type A = ::alloc::boxed::Box<u8>;
    |
    = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
 
-error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
+error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599)
   --> $DIR/feature-gate-extern_crate_item_prelude.rs:42:14
    |
 LL |     type A = core::boxed::Box<u8>;
diff --git a/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr
index 535ed94565c..a73533b6178 100644
--- a/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr
+++ b/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr
@@ -1,4 +1,4 @@
-error[E0658]: `extern` in paths is experimental (see issue #44660)
+error[E0658]: `extern` in paths is experimental (see issue #55600)
   --> $DIR/feature-gate-extern_in_paths.rs:14:13
    |
 LL |     let _ = extern::std::vec::Vec::new(); //~ ERROR `extern` in paths is experimental
diff --git a/src/test/ui/feature-gates/feature-gate-nll.nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.nll.stderr
deleted file mode 100644
index 81de0d14aa7..00000000000
--- a/src/test/ui/feature-gates/feature-gate-nll.nll.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error: compilation successful
-  --> $DIR/feature-gate-nll.rs:13:1
-   |
-LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
-LL | |     let mut x = 33;
-LL | |
-LL | |     let p = &x;
-LL | |     x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506]
-LL | | }
-   | |_^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/feature-gates/feature-gate-nll.rs b/src/test/ui/feature-gates/feature-gate-nll.rs
index 752b1fa821f..14c48fb48a0 100644
--- a/src/test/ui/feature-gates/feature-gate-nll.rs
+++ b/src/test/ui/feature-gates/feature-gate-nll.rs
@@ -1,16 +1,16 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-#![feature(rustc_attrs)]
+// This is a test checking that if you do not opt into NLL then you
+// should not get the effects of NLL applied to the test.
+
+// Don't use 2018 edition, since that turns on NLL (migration mode).
+// edition:2015
+
+// Don't use compare-mode=nll, since that turns on NLL.
+// ignore-compare-mode-nll
+
+
 #![allow(dead_code)]
 
-fn main() { #![rustc_error] // rust-lang/rust#49855
+fn main() {
     let mut x = 33;
 
     let p = &x;
diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs
deleted file mode 100644
index ca51154884f..00000000000
--- a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-C panic=abort
-
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation] //~ ERROR this attribute was renamed to `panic_handler` (see issue #44489)
-fn panic(info: &PanicInfo) -> ! {
-    loop {}
-}
diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr
deleted file mode 100644
index a54780468c4..00000000000
--- a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: this attribute was renamed to `panic_handler` (see issue #44489)
-  --> $DIR/feature-gate-panic-implementation.rs:18:1
-   |
-LL | #[panic_implementation] //~ ERROR this attribute was renamed to `panic_handler` (see issue #44489)
-   | ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add #![feature(panic_implementation)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/imports/issue-55457.rs b/src/test/ui/imports/issue-55457.rs
new file mode 100644
index 00000000000..9c6750fd48c
--- /dev/null
+++ b/src/test/ui/imports/issue-55457.rs
@@ -0,0 +1,8 @@
+use NonExistent; //~ ERROR unresolved import `NonExistent`
+use non_existent::non_existent; //~ ERROR unresolved import `non_existent`
+
+#[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent`
+#[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent`
+struct S;
+
+fn main() {}
diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr
new file mode 100644
index 00000000000..363dec06237
--- /dev/null
+++ b/src/test/ui/imports/issue-55457.stderr
@@ -0,0 +1,31 @@
+error[E0432]: unresolved import `NonExistent`
+  --> $DIR/issue-55457.rs:1:5
+   |
+LL | use NonExistent; //~ ERROR unresolved import `NonExistent`
+   |     ^^^^^^^^^^^ no `NonExistent` in the root. Did you mean to use `non_existent`?
+
+error[E0432]: unresolved import `non_existent`
+  --> $DIR/issue-55457.rs:2:5
+   |
+LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent`
+   |     ^^^^^^^^^^^^ Maybe a missing `extern crate non_existent;`?
+
+error: cannot determine resolution for the derive macro `NonExistent`
+  --> $DIR/issue-55457.rs:5:10
+   |
+LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent`
+   |          ^^^^^^^^^^^
+   |
+   = note: import resolution is stuck, try simplifying macro imports
+
+error: cannot determine resolution for the attribute macro `non_existent`
+  --> $DIR/issue-55457.rs:4:3
+   |
+LL | #[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent`
+   |   ^^^^^^^^^^^^
+   |
+   = note: import resolution is stuck, try simplifying macro imports
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/issues/issue-17263.stderr b/src/test/ui/issues/issue-17263.ast.stderr
index 4767fbbcfbb..3d42dcb52f5 100644
--- a/src/test/ui/issues/issue-17263.stderr
+++ b/src/test/ui/issues/issue-17263.ast.stderr
@@ -16,7 +16,7 @@ LL |     let (c, d) = (&mut foo.a, &foo.b);
    |                        -----   ^^^^^ immutable borrow occurs here (via `foo.b`)
    |                        |
    |                        mutable borrow occurs here (via `foo.a`)
-LL |     //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+...
 LL | }
    | - mutable borrow ends here
 
diff --git a/src/test/ui/issues/issue-17263.nll.stderr b/src/test/ui/issues/issue-17263.nll.stderr
index d6009e8078d..cdb574b8b9f 100644
--- a/src/test/ui/issues/issue-17263.nll.stderr
+++ b/src/test/ui/issues/issue-17263.nll.stderr
@@ -1,12 +1,12 @@
 error: compilation successful
   --> $DIR/issue-17263.rs:15:1
    |
-LL | / fn main() { #![rustc_error] // rust-lang/rust#49855
+LL | / fn main() { //[nll]~ ERROR compilation successful
 LL | |     let mut x: Box<_> = box Foo { a: 1, b: 2 };
 LL | |     let (a, b) = (&mut x.a, &mut x.b);
-LL | |     //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
+LL | |     //[ast]~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
 ...  |
-LL | |     //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+LL | |     use_mut(a);
 LL | | }
    | |_^
 
diff --git a/src/test/ui/issues/issue-17263.rs b/src/test/ui/issues/issue-17263.rs
index b251f9a4152..754f3b90aac 100644
--- a/src/test/ui/issues/issue-17263.rs
+++ b/src/test/ui/issues/issue-17263.rs
@@ -1,23 +1,35 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
+// This checks diagnostic quality for cases where AST-borrowck treated
+// `Box<T>` as other types (see rust-lang/rfcs#130). NLL again treats
+// `Box<T>` specially. We capture the differences via revisions.
 
+// revisions: ast nll
+//[ast]compile-flags: -Z borrowck=ast
+//[nll]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
+
+// don't worry about the --compare-mode=nll on this test.
+// ignore-compare-mode-nll
 #![feature(box_syntax, rustc_attrs)]
 
 struct Foo { a: isize, b: isize }
-
-fn main() { #![rustc_error] // rust-lang/rust#49855
+#[rustc_error] // rust-lang/rust#49855
+fn main() { //[nll]~ ERROR compilation successful
     let mut x: Box<_> = box Foo { a: 1, b: 2 };
     let (a, b) = (&mut x.a, &mut x.b);
-    //~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
+    //[ast]~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time
 
     let mut foo: Box<_> = box Foo { a: 1, b: 2 };
     let (c, d) = (&mut foo.a, &foo.b);
-    //~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+    //[ast]~^ ERROR cannot borrow `foo` (via `foo.b`) as immutable
+
+    // We explicitly use the references created above to illustrate
+    // that NLL is accepting this code *not* because of artificially
+    // short lifetimes, but rather because it understands that all the
+    // references are of disjoint parts of memory.
+    use_imm(d);
+    use_mut(c);
+    use_mut(b);
+    use_mut(a);
 }
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }
diff --git a/src/test/ui/issues/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr
index 783e831a2a5..b2bfe6b5e8c 100644
--- a/src/test/ui/issues/issue-3096-1.stderr
+++ b/src/test/ui/issues/issue-3096-1.stderr
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: type () is non-empty
 LL |     match () { } //~ ERROR non-exhaustive
    |           ^^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/issue-3096-1.rs:12:11
    |
 LL |     match () { } //~ ERROR non-exhaustive
diff --git a/src/test/ui/issues/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr
index 6031f25c03d..bb9dfabe7be 100644
--- a/src/test/ui/issues/issue-3096-2.stderr
+++ b/src/test/ui/issues/issue-3096-2.stderr
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: type *const bottom is non-empty
 LL |     match x { } //~ ERROR non-exhaustive patterns
    |           ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/issue-3096-2.rs:15:11
    |
 LL |     match x { } //~ ERROR non-exhaustive patterns
diff --git a/src/test/ui/issues/issue-31076.rs b/src/test/ui/issues/issue-31076.rs
new file mode 100644
index 00000000000..e4531072e9b
--- /dev/null
+++ b/src/test/ui/issues/issue-31076.rs
@@ -0,0 +1,17 @@
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang="sized"]
+trait Sized {}
+
+#[lang="add"]
+trait Add<T> {}
+
+impl Add<i32> for i32 {}
+
+fn main() {
+    let x = 5 + 6;
+    //~^ ERROR binary operation `+` cannot be applied to type `{integer}`
+    let y = 5i32 + 6i32;
+    //~^ ERROR binary operation `+` cannot be applied to type `i32`
+}
diff --git a/src/test/ui/issues/issue-31076.stderr b/src/test/ui/issues/issue-31076.stderr
new file mode 100644
index 00000000000..3a13f02d9f4
--- /dev/null
+++ b/src/test/ui/issues/issue-31076.stderr
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `+` cannot be applied to type `{integer}`
+  --> $DIR/issue-31076.rs:13:13
+   |
+LL |     let x = 5 + 6;
+   |             ^^^^^
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `{integer}`
+
+error[E0369]: binary operation `+` cannot be applied to type `i32`
+  --> $DIR/issue-31076.rs:15:13
+   |
+LL |     let y = 5i32 + 6i32;
+   |             ^^^^^^^^^^^
+   |
+   = note: an implementation of `std::ops::Add` might be missing for `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
index b25b063f3b6..2165d951102 100644
--- a/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
+++ b/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
@@ -3,9 +3,9 @@ error[E0597]: `line` does not live long enough
    |
 LL |         let v: Vec<&str> = line.split_whitespace().collect();
    |                            ^^^^ borrowed value does not live long enough
-LL |         //~^ ERROR `line` does not live long enough
-LL |         println!("accumulator before add_assign {:?}", acc.map);
-   |                                                        ------- borrow used here, in later iteration of loop
+...
+LL |         acc += cnt2;
+   |         --- borrow used here, in later iteration of loop
 ...
 LL |     }
    |     - `line` dropped here while still borrowed
diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.rs b/src/test/ui/issues/issue-52126-assign-op-invariance.rs
index b26ad9bc37d..1a353f9ea7c 100644
--- a/src/test/ui/issues/issue-52126-assign-op-invariance.rs
+++ b/src/test/ui/issues/issue-52126-assign-op-invariance.rs
@@ -43,7 +43,7 @@ pub fn panics() {
     for line in vec!["123456789".to_string(), "12345678".to_string()] {
         let v: Vec<&str> = line.split_whitespace().collect();
         //~^ ERROR `line` does not live long enough
-        println!("accumulator before add_assign {:?}", acc.map);
+        // println!("accumulator before add_assign {:?}", acc.map);
         let mut map = HashMap::new();
         for str_ref in v {
             let e = map.entry(str_ref);
@@ -53,7 +53,7 @@ pub fn panics() {
         }
         let cnt2 = Counter{map};
         acc += cnt2;
-        println!("accumulator after add_assign {:?}", acc.map);
+        // println!("accumulator after add_assign {:?}", acc.map);
         // line gets dropped here but references are kept in acc.map
     }
 }
diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr b/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr
deleted file mode 100644
index fabfba94878..00000000000
--- a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: use of deprecated attribute `panic_implementation`: this attribute was renamed to `panic_handler`. See https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224
-  --> $DIR/panic-implementation-deprecated.rs:19:1
-   |
-LL | #[panic_implementation]
-   | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[panic_handler]`
-   |
-note: lint level defined here
-  --> $DIR/panic-implementation-deprecated.rs:13:9
-   |
-LL | #![deny(deprecated)]
-   |         ^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
index 4a693a3b05d..389a1116c16 100644
--- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
+++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr
@@ -14,6 +14,16 @@ LL | fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
 LL |     &mut x.y //~ ERROR cannot borrow
    |          ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+  --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:19
+   |
+LL |     let _x = &mut x.x;
+   |                   - first mutable borrow occurs here
+LL |     let _y = &mut x.y; //~ ERROR cannot borrow
+   |                   ^ second mutable borrow occurs here
+LL |     use_mut(_x);
+   |             -- first borrow later used here
+
 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5
    |
@@ -30,6 +40,16 @@ LL | fn assign_field2<'a>(x: &'a Own<Point>) {
 LL |     x.y = 3; //~ ERROR cannot borrow
    |     ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+  --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:111:5
+   |
+LL |     let _p: &mut Point = &mut **x;
+   |                                -- first mutable borrow occurs here
+LL |     x.y = 3; //~ ERROR cannot borrow
+   |     ^ second mutable borrow occurs here
+LL |     use_mut(_p);
+   |             -- first borrow later used here
+
 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
   --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5
    |
@@ -62,6 +82,7 @@ LL | fn assign_method2<'a>(x: &'a Own<Point>) {
 LL |     *x.y_mut() = 3; //~ ERROR cannot borrow
    |      ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
-error: aborting due to 8 previous errors
+error: aborting due to 10 previous errors
 
-For more information about this error, try `rustc --explain E0596`.
+Some errors occurred: E0499, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs
index 764d05be879..48eb2e239f7 100644
--- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs
+++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs
@@ -86,8 +86,8 @@ fn deref_extend_mut_field3(x: &mut Own<Point>) {
 
     let _x = &mut x.x;
     let _y = &mut x.y; //~ ERROR cannot borrow
+    use_mut(_x);
 }
-
 fn deref_extend_mut_field4<'a>(x: &'a mut Own<Point>) {
     let p = &mut **x;
     let _x = &mut p.x;
@@ -109,8 +109,8 @@ fn assign_field3<'a>(x: &'a mut Own<Point>) {
 fn assign_field4<'a>(x: &'a mut Own<Point>) {
     let _p: &mut Point = &mut **x;
     x.y = 3; //~ ERROR cannot borrow
+    use_mut(_p);
 }
-
 fn deref_imm_method(x: Own<Point>) {
     let __isize = x.get();
 }
@@ -148,3 +148,5 @@ fn assign_method3<'a>(x: &'a mut Own<Point>) {
 }
 
 pub fn main() {}
+
+fn use_mut<T>(_: &mut T) {}
diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
index d91ff696423..864357fee9f 100644
--- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
+++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr
@@ -21,6 +21,7 @@ LL |     let _x = &mut x.x;
    |                   - first mutable borrow occurs here
 LL |     let _y = &mut x.y; //~ ERROR cannot borrow
    |                   ^ second mutable borrow occurs here
+LL |     use_mut(_x);
 LL | }
    | - first borrow ends here
 
@@ -47,6 +48,7 @@ LL |     let _p: &mut Point = &mut **x;
    |                                -- first mutable borrow occurs here
 LL |     x.y = 3; //~ ERROR cannot borrow
    |     ^ second mutable borrow occurs here
+LL |     use_mut(_p);
 LL | }
    | - first borrow ends here
 
diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
index d86ebda027e..83fd736a997 100644
--- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
+++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
@@ -10,7 +10,7 @@ error[E0004]: non-exhaustive patterns: type &Void is non-empty
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
    |                   ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/uninhabited-matches-feature-gated.rs:20:19
    |
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
@@ -22,7 +22,7 @@ error[E0004]: non-exhaustive patterns: type (Void,) is non-empty
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
    |                   ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/uninhabited-matches-feature-gated.rs:23:19
    |
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
@@ -34,7 +34,7 @@ error[E0004]: non-exhaustive patterns: type [Void; 1] is non-empty
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
    |                   ^
    |
-help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   --> $DIR/uninhabited-matches-feature-gated.rs:26:19
    |
 LL |     let _ = match x {}; //~ ERROR non-exhaustive
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
index a4f5e41b529..6b18aff9f6b 100644
--- a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
@@ -1,33 +1,64 @@
+error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable
+  --> $DIR/union-borrow-move-parent-sibling.rs:25:13
+   |
+LL |     let a = &mut u.x.0;
+   |             ---------- mutable borrow occurs here
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
+   |             ^^^^ immutable borrow occurs here
+LL |     use_borrow(a);
+   |                - mutable borrow later used here
+
 error[E0382]: use of moved value: `u`
-  --> $DIR/union-borrow-move-parent-sibling.rs:29:13
+  --> $DIR/union-borrow-move-parent-sibling.rs:32:13
    |
 LL |     let a = u.x.0;
    |             ----- value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |             ^^^ value used here after move
    |
    = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
 
+error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable
+  --> $DIR/union-borrow-move-parent-sibling.rs:38:13
+   |
+LL |     let a = &mut (u.x.0).0;
+   |             -------------- mutable borrow occurs here
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
+   |             ^^^^ immutable borrow occurs here
+LL |     use_borrow(a);
+   |                - mutable borrow later used here
+
 error[E0382]: use of moved value: `u`
-  --> $DIR/union-borrow-move-parent-sibling.rs:41:13
+  --> $DIR/union-borrow-move-parent-sibling.rs:45:13
    |
 LL |     let a = (u.x.0).0;
    |             --------- value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |             ^^^ value used here after move
    |
    = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
 
+error[E0502]: cannot borrow `u.x` as immutable because it is also borrowed as mutable
+  --> $DIR/union-borrow-move-parent-sibling.rs:51:13
+   |
+LL |     let a = &mut *u.y;
+   |             --------- mutable borrow occurs here
+LL |     let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+   |             ^^^^ immutable borrow occurs here
+LL |     use_borrow(a);
+   |                - mutable borrow later used here
+
 error[E0382]: use of moved value: `u`
-  --> $DIR/union-borrow-move-parent-sibling.rs:53:13
+  --> $DIR/union-borrow-move-parent-sibling.rs:58:13
    |
 LL |     let a = *u.y;
    |             ---- value moved here
-LL |     let a = u.x; //~ ERROR use of moved value: `u.x`
+LL |     let b = u.x; //~ ERROR use of moved value: `u.x`
    |             ^^^ value used here after move
    |
    = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
 
-error: aborting due to 3 previous errors
+error: aborting due to 6 previous errors
 
-For more information about this error, try `rustc --explain E0382`.
+Some errors occurred: E0382, E0502.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.rs b/src/test/ui/union/union-borrow-move-parent-sibling.rs
index 5f504feabb2..99a073b838c 100644
--- a/src/test/ui/union/union-borrow-move-parent-sibling.rs
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.rs
@@ -17,40 +17,45 @@ union U {
     y: Box<Vec<u8>>,
 }
 
+fn use_borrow<T>(_: &T) {}
+
 unsafe fn parent_sibling_borrow() {
     let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = &mut u.x.0;
-    let a = &u.y; //~ ERROR cannot borrow `u.y`
+    let b = &u.y; //~ ERROR cannot borrow `u.y`
+    use_borrow(a);
 }
 
 unsafe fn parent_sibling_move() {
     let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = u.x.0;
-    let a = u.y; //~ ERROR use of moved value: `u.y`
+    let b = u.y; //~ ERROR use of moved value: `u.y`
 }
 
 unsafe fn grandparent_sibling_borrow() {
     let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = &mut (u.x.0).0;
-    let a = &u.y; //~ ERROR cannot borrow `u.y`
+    let b = &u.y; //~ ERROR cannot borrow `u.y`
+    use_borrow(a);
 }
 
 unsafe fn grandparent_sibling_move() {
     let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = (u.x.0).0;
-    let a = u.y; //~ ERROR use of moved value: `u.y`
+    let b = u.y; //~ ERROR use of moved value: `u.y`
 }
 
 unsafe fn deref_sibling_borrow() {
     let mut u = U { y: Box::default() };
     let a = &mut *u.y;
-    let a = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+    let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+    use_borrow(a);
 }
 
 unsafe fn deref_sibling_move() {
     let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
     let a = *u.y;
-    let a = u.x; //~ ERROR use of moved value: `u.x`
+    let b = u.x; //~ ERROR use of moved value: `u.x`
 }
 
 
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.stderr
index d855435416e..daf5a4f4fcc 100644
--- a/src/test/ui/union/union-borrow-move-parent-sibling.stderr
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.stderr
@@ -1,59 +1,62 @@
 error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable
-  --> $DIR/union-borrow-move-parent-sibling.rs:23:14
+  --> $DIR/union-borrow-move-parent-sibling.rs:25:14
    |
 LL |     let a = &mut u.x.0;
    |                  ----- mutable borrow occurs here
-LL |     let a = &u.y; //~ ERROR cannot borrow `u.y`
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
    |              ^^^ immutable borrow occurs here
+LL |     use_borrow(a);
 LL | }
    | - mutable borrow ends here
 
 error[E0382]: use of moved value: `u.y`
-  --> $DIR/union-borrow-move-parent-sibling.rs:29:9
+  --> $DIR/union-borrow-move-parent-sibling.rs:32:9
    |
 LL |     let a = u.x.0;
    |         - value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |         ^ value used here after move
    |
    = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
 
 error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable
-  --> $DIR/union-borrow-move-parent-sibling.rs:35:14
+  --> $DIR/union-borrow-move-parent-sibling.rs:38:14
    |
 LL |     let a = &mut (u.x.0).0;
    |                  --------- mutable borrow occurs here
-LL |     let a = &u.y; //~ ERROR cannot borrow `u.y`
+LL |     let b = &u.y; //~ ERROR cannot borrow `u.y`
    |              ^^^ immutable borrow occurs here
+LL |     use_borrow(a);
 LL | }
    | - mutable borrow ends here
 
 error[E0382]: use of moved value: `u.y`
-  --> $DIR/union-borrow-move-parent-sibling.rs:41:9
+  --> $DIR/union-borrow-move-parent-sibling.rs:45:9
    |
 LL |     let a = (u.x.0).0;
    |         - value moved here
-LL |     let a = u.y; //~ ERROR use of moved value: `u.y`
+LL |     let b = u.y; //~ ERROR use of moved value: `u.y`
    |         ^ value used here after move
    |
    = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
 
 error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`)
-  --> $DIR/union-borrow-move-parent-sibling.rs:47:14
+  --> $DIR/union-borrow-move-parent-sibling.rs:51:14
    |
 LL |     let a = &mut *u.y;
    |                  ---- mutable borrow occurs here (via `*u.y`)
-LL |     let a = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+LL |     let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
    |              ^^^ immutable borrow occurs here (via `u.x`)
+LL |     use_borrow(a);
 LL | }
    | - mutable borrow ends here
 
 error[E0382]: use of moved value: `u.x`
-  --> $DIR/union-borrow-move-parent-sibling.rs:53:9
+  --> $DIR/union-borrow-move-parent-sibling.rs:58:9
    |
 LL |     let a = *u.y;
    |         - value moved here
-LL |     let a = u.x; //~ ERROR use of moved value: `u.x`
+LL |     let b = u.x; //~ ERROR use of moved value: `u.x`
    |         ^ value used here after move
    |
    = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait
diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr
index 111940aab2c..bfc7736b2f3 100644
--- a/src/test/ui/unop-move-semantics.nll.stderr
+++ b/src/test/ui/unop-move-semantics.nll.stderr
@@ -9,6 +9,29 @@ LL |     x.clone();  //~ ERROR: use of moved value
    |
    = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
 
+error[E0505]: cannot move out of `x` because it is borrowed
+  --> $DIR/unop-move-semantics.rs:25:6
+   |
+LL |     let m = &x;
+   |             -- borrow of `x` occurs here
+...
+LL |     !x;  //~ ERROR: cannot move out of `x` because it is borrowed
+   |      ^ move out of `x` occurs here
+...
+LL |     use_mut(n); use_imm(m);
+   |                         - borrow later used here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/unop-move-semantics.rs:27:6
+   |
+LL |     let n = &mut y;
+   |             ------ borrow of `y` occurs here
+...
+LL |     !y;  //~ ERROR: cannot move out of `y` because it is borrowed
+   |      ^ move out of `y` occurs here
+LL |     use_mut(n); use_imm(m);
+   |             - borrow later used here
+
 error[E0507]: cannot move out of borrowed content
   --> $DIR/unop-move-semantics.rs:34:6
    |
@@ -21,7 +44,7 @@ error[E0507]: cannot move out of borrowed content
 LL |     !*n;  //~ ERROR: cannot move out of borrowed content
    |      ^^ cannot move out of borrowed content
 
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
 
-Some errors occurred: E0382, E0507.
+Some errors occurred: E0382, E0505, E0507.
 For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/unop-move-semantics.rs b/src/test/ui/unop-move-semantics.rs
index 94656667598..fcbbe546a31 100644
--- a/src/test/ui/unop-move-semantics.rs
+++ b/src/test/ui/unop-move-semantics.rs
@@ -25,8 +25,8 @@ fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
     !x;  //~ ERROR: cannot move out of `x` because it is borrowed
 
     !y;  //~ ERROR: cannot move out of `y` because it is borrowed
+    use_mut(n); use_imm(m);
 }
-
 fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
     let m = &mut x;
     let n = &y;
@@ -34,6 +34,9 @@ fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
     !*m;  //~ ERROR: cannot move out of borrowed content
 
     !*n;  //~ ERROR: cannot move out of borrowed content
+    use_imm(n); use_mut(m);
 }
-
 fn main() {}
+
+fn use_mut<T>(_: &mut T) { }
+fn use_imm<T>(_: &T) { }