about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-12-14 09:57:34 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-12-15 13:52:05 -0800
commitb562565b09a2d13596c03635e5485c4c4814b33e (patch)
tree59a113d51f133b7f32bcbd5ab33e427e55b0091d
parent02079e44dd81754de064de1c6153f6b55e4ec06e (diff)
downloadrust-b562565b09a2d13596c03635e5485c4c4814b33e.tar.gz
rust-b562565b09a2d13596c03635e5485c4c4814b33e.zip
Same change to point at borrow for mir errors
-rw-r--r--src/librustc_mir/borrow_check/error_reporting.rs14
-rw-r--r--src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs2
-rw-r--r--src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs2
-rw-r--r--src/test/compile-fail/E0597.rs3
-rw-r--r--src/test/compile-fail/catch-bad-lifetime.rs3
-rw-r--r--src/test/compile-fail/issue-36082.rs4
-rw-r--r--src/test/compile-fail/region-borrow-params-issue-29793-big.rs4
-rw-r--r--src/test/ui/issue-46471-1.rs2
-rw-r--r--src/test/ui/issue-46471-1.stderr6
-rw-r--r--src/test/ui/issue-46471.stderr2
-rw-r--r--src/test/ui/issue-46472.stderr2
-rw-r--r--src/test/ui/nll/capture-ref-in-struct.stderr2
-rw-r--r--src/test/ui/nll/closure-requirements/escape-argument.stderr2
-rw-r--r--src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr2
-rw-r--r--src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr2
-rw-r--r--src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr2
-rw-r--r--src/test/ui/region-borrow-params-issue-29793-small.stderr8
-rw-r--r--src/test/ui/span/borrowck-let-suggestion-suffixes.rs1
-rw-r--r--src/test/ui/span/borrowck-let-suggestion-suffixes.stderr38
-rw-r--r--src/test/ui/span/dropck-object-cycle.rs2
-rw-r--r--src/test/ui/span/dropck-object-cycle.stderr8
-rw-r--r--src/test/ui/span/issue-36537.rs2
-rw-r--r--src/test/ui/span/issue-36537.stderr9
-rw-r--r--src/test/ui/span/regions-escape-loop-via-vec.rs2
-rw-r--r--src/test/ui/span/regions-escape-loop-via-vec.stderr15
25 files changed, 71 insertions, 68 deletions
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs
index 186598001da..679e9059c4e 100644
--- a/src/librustc_mir/borrow_check/error_reporting.rs
+++ b/src/librustc_mir/borrow_check/error_reporting.rs
@@ -394,10 +394,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
         &mut self, name: &String, _scope_tree: &Rc<ScopeTree>, _borrow: &BorrowData<'tcx>,
         drop_span: Span, borrow_span: Span, _proper_span: Span, end_span: Option<Span>
     ) {
-        let mut err = self.tcx.path_does_not_live_long_enough(drop_span,
+        let mut err = self.tcx.path_does_not_live_long_enough(borrow_span,
                                                               &format!("`{}`", name),
                                                               Origin::Mir);
-        err.span_label(borrow_span, "borrow occurs here");
+        err.span_label(borrow_span, "borrowed value does not live long enough");
         err.span_label(drop_span, format!("`{}` dropped here while still borrowed", name));
         if let Some(end) = end_span {
             err.span_label(end, "borrowed value needs to live until here");
@@ -407,12 +407,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
 
     fn report_scoped_temporary_value_does_not_live_long_enough(
         &mut self, _scope_tree: &Rc<ScopeTree>, _borrow: &BorrowData<'tcx>,
-        drop_span: Span, borrow_span: Span, proper_span: Span, end_span: Option<Span>
+        drop_span: Span, _borrow_span: Span, proper_span: Span, end_span: Option<Span>
     ) {
-        let mut err = self.tcx.path_does_not_live_long_enough(borrow_span,
+        let mut err = self.tcx.path_does_not_live_long_enough(proper_span,
                                                               "borrowed value",
                                                               Origin::Mir);
-        err.span_label(proper_span, "temporary value created here");
+        err.span_label(proper_span, "temporary value does not live long enough");
         err.span_label(drop_span, "temporary value dropped here while still borrowed");
         err.note("consider using a `let` binding to increase its lifetime");
         if let Some(end) = end_span {
@@ -428,7 +428,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
         let mut err = self.tcx.path_does_not_live_long_enough(borrow_span,
                                                               &format!("`{}`", name),
                                                               Origin::Mir);
-        err.span_label(borrow_span, "does not live long enough");
+        err.span_label(borrow_span, "borrowed value does not live long enough");
         err.span_label(drop_span, "borrowed value only lives until here");
         self.tcx.note_and_explain_region(scope_tree, &mut err,
                                          "borrowed value must be valid for ",
@@ -443,7 +443,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
         let mut err = self.tcx.path_does_not_live_long_enough(proper_span,
                                                               "borrowed value",
                                                               Origin::Mir);
-        err.span_label(proper_span, "does not live long enough");
+        err.span_label(proper_span, "temporary value does not live long enough");
         err.span_label(drop_span, "temporary value only lives until here");
         self.tcx.note_and_explain_region(scope_tree, &mut err,
                                          "borrowed value must be valid for ",
diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
index bc88ff9244c..f368788af55 100644
--- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
+++ b/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs
@@ -124,4 +124,4 @@ fn f<'a>(arena: &'a TypedArena<C<'a>>) {
 fn main() {
     let arena = TypedArena::new();
     f(&arena);
-} //~ ERROR `arena` does not live long enough
+} //~^ ERROR `arena` does not live long enough
diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs
index 30829847a3a..531e1ada44b 100644
--- a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs
+++ b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs
@@ -49,5 +49,5 @@ fn f<'a>(_arena: &'a TypedArena<C<'a>>) {}
 fn main() {
     let arena: TypedArena<C> = TypedArena::new();
     f(&arena);
-} //~ ERROR `arena` does not live long enough
+} //~^ ERROR `arena` does not live long enough
 
diff --git a/src/test/compile-fail/E0597.rs b/src/test/compile-fail/E0597.rs
index 00ef14a8e2a..2f4a1da91d8 100644
--- a/src/test/compile-fail/E0597.rs
+++ b/src/test/compile-fail/E0597.rs
@@ -16,4 +16,5 @@ fn main() {
     let mut x = Foo { x: None };
     let y = 0;
     x.x = Some(&y);
-} //~ `y` does not live long enough [E0597]
+    //~^ `y` does not live long enough [E0597]
+}
diff --git a/src/test/compile-fail/catch-bad-lifetime.rs b/src/test/compile-fail/catch-bad-lifetime.rs
index 57242dad6e3..f24561b8887 100644
--- a/src/test/compile-fail/catch-bad-lifetime.rs
+++ b/src/test/compile-fail/catch-bad-lifetime.rs
@@ -18,10 +18,11 @@ pub fn main() {
         let _result: Result<(), &str> = do catch {
             let my_string = String::from("");
             let my_str: & str = & my_string;
+            //~^ ERROR `my_string` does not live long enough
             Err(my_str) ?;
             Err("") ?;
             Ok(())
-        }; //~ ERROR `my_string` does not live long enough
+        };
     }
 
     {
diff --git a/src/test/compile-fail/issue-36082.rs b/src/test/compile-fail/issue-36082.rs
index 33a9b1e926c..fc3e0633750 100644
--- a/src/test/compile-fail/issue-36082.rs
+++ b/src/test/compile-fail/issue-36082.rs
@@ -21,11 +21,11 @@ fn main() {
     let val: &_ = x.borrow().0;
     //[ast]~^ ERROR borrowed value does not live long enough [E0597]
     //[ast]~| NOTE temporary value dropped here while still borrowed
-    //[ast]~| NOTE temporary value created here
+    //[ast]~| NOTE temporary value does not live long enough
     //[ast]~| NOTE consider using a `let` binding to increase its lifetime
     //[mir]~^^^^^ ERROR borrowed value does not live long enough [E0597]
     //[mir]~| NOTE temporary value dropped here while still borrowed
-    //[mir]~| NOTE temporary value created here
+    //[mir]~| NOTE temporary value does not live long enough
     //[mir]~| NOTE consider using a `let` binding to increase its lifetime
     println!("{}", val);
 }
diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-big.rs b/src/test/compile-fail/region-borrow-params-issue-29793-big.rs
index 2e2dfdb03d9..642e90f6de8 100644
--- a/src/test/compile-fail/region-borrow-params-issue-29793-big.rs
+++ b/src/test/compile-fail/region-borrow-params-issue-29793-big.rs
@@ -81,9 +81,9 @@ fn main() {
         WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
             //[ast]~^ ERROR `x` does not live long enough
             //[ast]~| ERROR `y` does not live long enough
+            //[mir]~^^^ ERROR `x` does not live long enough
+            //[mir]~| ERROR `y` does not live long enough
     });
-    //[mir]~^ ERROR `x` does not live long enough
-    //[mir]~| ERROR `y` does not live long enough
 
     w.handle(); // This works
     // w.handle_ref(); // This doesn't
diff --git a/src/test/ui/issue-46471-1.rs b/src/test/ui/issue-46471-1.rs
index 977ea785fe6..0dbcdea89f9 100644
--- a/src/test/ui/issue-46471-1.rs
+++ b/src/test/ui/issue-46471-1.rs
@@ -15,7 +15,7 @@ fn main() {
         let mut z = 0;
         &mut z
     };
-    //~^ ERROR `z` does not live long enough (Ast) [E0597]
+    //~^^ ERROR `z` does not live long enough (Ast) [E0597]
     //~| ERROR `z` does not live long enough (Mir) [E0597]
     println!("{}", y);
 }
diff --git a/src/test/ui/issue-46471-1.stderr b/src/test/ui/issue-46471-1.stderr
index 466ae501a32..9f12092f99c 100644
--- a/src/test/ui/issue-46471-1.stderr
+++ b/src/test/ui/issue-46471-1.stderr
@@ -10,12 +10,12 @@ error[E0597]: `z` does not live long enough (Ast)
    | - borrowed value needs to live until here
 
 error[E0597]: `z` does not live long enough (Mir)
-  --> $DIR/issue-46471-1.rs:17:6
+  --> $DIR/issue-46471-1.rs:16:9
    |
 16 |         &mut z
-   |         ------ borrow occurs here
+   |         ^^^^^^ borrowed value does not live long enough
 17 |     };
-   |      ^ `z` dropped here while still borrowed
+   |      - `z` dropped here while still borrowed
 ...
 21 | }
    | - borrowed value needs to live until here
diff --git a/src/test/ui/issue-46471.stderr b/src/test/ui/issue-46471.stderr
index bddd1a9f232..19fc579d198 100644
--- a/src/test/ui/issue-46471.stderr
+++ b/src/test/ui/issue-46471.stderr
@@ -13,7 +13,7 @@ error[E0597]: `x` does not live long enough (Mir)
   --> $DIR/issue-46471.rs:15:5
    |
 15 |     &x
-   |     ^^ does not live long enough
+   |     ^^ borrowed value does not live long enough
 ...
 18 | }
    |  - borrowed value only lives until here
diff --git a/src/test/ui/issue-46472.stderr b/src/test/ui/issue-46472.stderr
index a6bde956fca..50df72fc2a0 100644
--- a/src/test/ui/issue-46472.stderr
+++ b/src/test/ui/issue-46472.stderr
@@ -21,7 +21,7 @@ error[E0597]: borrowed value does not live long enough (Mir)
   --> $DIR/issue-46472.rs:14:10
    |
 14 |     &mut 4
-   |          ^ does not live long enough
+   |          ^ temporary value does not live long enough
 ...
 17 | }
    |  - temporary value only lives until here
diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr
index 6b57f91987b..ed57d89802c 100644
--- a/src/test/ui/nll/capture-ref-in-struct.stderr
+++ b/src/test/ui/nll/capture-ref-in-struct.stderr
@@ -2,7 +2,7 @@ error[E0597]: `y` does not live long enough
   --> $DIR/capture-ref-in-struct.rs:32:16
    |
 32 |             y: &y,
-   |                ^^ does not live long enough
+   |                ^^ borrowed value does not live long enough
 ...
 37 |     }
    |      - borrowed value only lives until here
diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr
index 0ec671997e7..4e9a25e2892 100644
--- a/src/test/ui/nll/closure-requirements/escape-argument.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr
@@ -28,7 +28,7 @@ error[E0597]: `y` does not live long enough
   --> $DIR/escape-argument.rs:37:25
    |
 37 |         closure(&mut p, &y);
-   |                         ^^ does not live long enough
+   |                         ^^ borrowed value does not live long enough
 38 |         //~^ ERROR `y` does not live long enough [E0597]
 39 |     }
    |      - borrowed value only lives until here
diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr
index 6c70afa0c9c..60bd7a569a0 100644
--- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr
@@ -54,7 +54,7 @@ error[E0597]: `y` does not live long enough
 31 | |             let mut closure1 = || p = &y;
 32 | |             closure1();
 33 | |         };
-   | |_________^ does not live long enough
+   | |_________^ borrowed value does not live long enough
 ...
 36 |       }
    |        - borrowed value only lives until here
diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
index 0b982dd812b..dc86f4cff08 100644
--- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
+++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
@@ -31,7 +31,7 @@ error[E0597]: `y` does not live long enough
   --> $DIR/escape-upvar-ref.rs:33:27
    |
 33 |         let mut closure = || p = &y;
-   |                           ^^^^^^^^^ does not live long enough
+   |                           ^^^^^^^^^ borrowed value does not live long enough
 ...
 36 |     }
    |      - borrowed value only lives until here
diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
index b93c69dc13f..9b23c48e249 100644
--- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
+++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
@@ -75,7 +75,7 @@ error[E0597]: `a` does not live long enough
   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:41:26
    |
 41 |     let cell = Cell::new(&a);
-   |                          ^^ does not live long enough
+   |                          ^^ borrowed value does not live long enough
 ...
 49 | }
    | - borrowed value only lives until here
diff --git a/src/test/ui/region-borrow-params-issue-29793-small.stderr b/src/test/ui/region-borrow-params-issue-29793-small.stderr
index d640d5c8bd9..7cdea5b0bd2 100644
--- a/src/test/ui/region-borrow-params-issue-29793-small.stderr
+++ b/src/test/ui/region-borrow-params-issue-29793-small.stderr
@@ -2,7 +2,7 @@ error[E0597]: `x` does not live long enough
   --> $DIR/region-borrow-params-issue-29793-small.rs:19:34
    |
 19 |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
-   |                 ---------        ^ does not live long enough
+   |                 ---------        ^ borrowed value does not live long enough
    |                 |
    |                 capture occurs here
 ...
@@ -15,7 +15,7 @@ error[E0597]: `y` does not live long enough
   --> $DIR/region-borrow-params-issue-29793-small.rs:19:45
    |
 19 |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
-   |                 ---------                   ^ does not live long enough
+   |                 ---------                   ^ borrowed value does not live long enough
    |                 |
    |                 capture occurs here
 ...
@@ -28,7 +28,7 @@ error[E0597]: `x` does not live long enough
   --> $DIR/region-borrow-params-issue-29793-small.rs:34:34
    |
 34 |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
-   |                 ---------        ^ does not live long enough
+   |                 ---------        ^ borrowed value does not live long enough
    |                 |
    |                 capture occurs here
 ...
@@ -41,7 +41,7 @@ error[E0597]: `y` does not live long enough
   --> $DIR/region-borrow-params-issue-29793-small.rs:34:45
    |
 34 |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
-   |                 ---------                   ^ does not live long enough
+   |                 ---------                   ^ borrowed value does not live long enough
    |                 |
    |                 capture occurs here
 ...
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
index 5d7d1cd30c0..8a27af0119a 100644
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
+++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs
@@ -42,6 +42,7 @@ fn f() {
         //~| NOTE consider using a `let` binding to increase its lifetime
 
     }                       // (statement 7)
+    //~^ NOTE temporary value needs to live until here
 
     let mut v5 = Vec::new(); // statement 8
 
diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
index 3daeb71d346..e65fd723e5f 100644
--- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
+++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr
@@ -1,49 +1,49 @@
 error[E0597]: `young[..]` does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:43:1
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:21:14
    |
 21 |     v2.push(&young[0]);      // statement 4
-   |              -------- borrow occurs here
+   |              ^^^^^^^^ borrowed value does not live long enough
 ...
-43 | }
-   | ^ `young[..]` dropped here while still borrowed
+56 | }
+   | - `young[..]` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:25:22
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:28:14
    |
-25 |     v3.push(&id('x'));           // statement 6
-   |              ------- ^ temporary value dropped here while still borrowed
+28 |     v3.push(&id('x'));           // statement 6
+   |              ^^^^^^^ - temporary value dropped here while still borrowed
    |              |
-   |              temporary value created here
+   |              temporary value does not live long enough
 ...
-43 | }
+56 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
 
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:32:26
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:38:18
    |
-32 |         v4.push(&id('y'));
-   |                  ------- ^ temporary value dropped here while still borrowed
+38 |         v4.push(&id('y'));
+   |                  ^^^^^^^ - temporary value dropped here while still borrowed
    |                  |
-   |                  temporary value created here
+   |                  temporary value does not live long enough
 ...
-35 |     }                       // (statement 7)
+44 |     }                       // (statement 7)
    |     - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
 
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion-suffixes.rs:39:22
+  --> $DIR/borrowck-let-suggestion-suffixes.rs:49:14
    |
-39 |     v5.push(&id('z'));
-   |              ------- ^ temporary value dropped here while still borrowed
+49 |     v5.push(&id('z'));
+   |              ^^^^^^^ - temporary value dropped here while still borrowed
    |              |
-   |              temporary value created here
+   |              temporary value does not live long enough
 ...
-43 | }
+56 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs
index aaa5cd415bb..b2871342e88 100644
--- a/src/test/ui/span/dropck-object-cycle.rs
+++ b/src/test/ui/span/dropck-object-cycle.rs
@@ -35,6 +35,7 @@ impl<'t> MakerTrait for Box<Trait<'t>+'static> {
 pub fn main() {
     let m : Box<Trait+'static> = make_val();
     assert_eq!(object_invoke1(&*m), (4,5));
+    //~^ ERROR `*m` does not live long enough
 
     // the problem here is that the full type of `m` is
     //
@@ -54,5 +55,4 @@ pub fn main() {
     // the type of `m` *strictly outlives* `'m`. Hence we get an
     // error.
 }
-//~^ ERROR `*m` does not live long enough
 
diff --git a/src/test/ui/span/dropck-object-cycle.stderr b/src/test/ui/span/dropck-object-cycle.stderr
index 5e87534c391..2b760415a1a 100644
--- a/src/test/ui/span/dropck-object-cycle.stderr
+++ b/src/test/ui/span/dropck-object-cycle.stderr
@@ -1,11 +1,11 @@
 error[E0597]: `*m` does not live long enough
-  --> $DIR/dropck-object-cycle.rs:56:1
+  --> $DIR/dropck-object-cycle.rs:37:32
    |
 37 |     assert_eq!(object_invoke1(&*m), (4,5));
-   |                                -- borrow occurs here
+   |                                ^^ borrowed value does not live long enough
 ...
-56 | }
-   | ^ `*m` dropped here while still borrowed
+57 | }
+   | - `*m` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
diff --git a/src/test/ui/span/issue-36537.rs b/src/test/ui/span/issue-36537.rs
index d016e8fdbc0..3eac0106b18 100644
--- a/src/test/ui/span/issue-36537.rs
+++ b/src/test/ui/span/issue-36537.rs
@@ -12,5 +12,5 @@ fn main() {
     let p;
     let a = 42;
     p = &a;
+    //~^ ERROR `a` does not live long enough
 }
-//~^ ERROR `a` does not live long enough
diff --git a/src/test/ui/span/issue-36537.stderr b/src/test/ui/span/issue-36537.stderr
index fed240a850d..255700a55f3 100644
--- a/src/test/ui/span/issue-36537.stderr
+++ b/src/test/ui/span/issue-36537.stderr
@@ -1,10 +1,11 @@
 error[E0597]: `a` does not live long enough
-  --> $DIR/issue-36537.rs:15:1
+  --> $DIR/issue-36537.rs:14:10
    |
 14 |     p = &a;
-   |          - borrow occurs here
-15 | }
-   | ^ `a` dropped here while still borrowed
+   |          ^ borrowed value does not live long enough
+15 |     //~^ ERROR `a` does not live long enough
+16 | }
+   | - `a` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
diff --git a/src/test/ui/span/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs
index 19f580f51b4..8e85ca5bcea 100644
--- a/src/test/ui/span/regions-escape-loop-via-vec.rs
+++ b/src/test/ui/span/regions-escape-loop-via-vec.rs
@@ -15,9 +15,9 @@ fn broken() {
     while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
         let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
         _y.push(&mut z);
+        //~^ ERROR `z` does not live long enough
         x += 1; //~ ERROR cannot assign
     }
-    //~^ ERROR `z` does not live long enough
 }
 
 fn main() { }
diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr
index 13614e31066..73ff449b2b5 100644
--- a/src/test/ui/span/regions-escape-loop-via-vec.stderr
+++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr
@@ -1,12 +1,11 @@
 error[E0597]: `z` does not live long enough
-  --> $DIR/regions-escape-loop-via-vec.rs:19:5
+  --> $DIR/regions-escape-loop-via-vec.rs:17:22
    |
 17 |         _y.push(&mut z);
-   |                      - borrow occurs here
-18 |         x += 1; //~ ERROR cannot assign
-19 |     }
-   |     ^ `z` dropped here while still borrowed
-20 |     //~^ ERROR `z` does not live long enough
+   |                      ^ borrowed value does not live long enough
+...
+20 |     }
+   |     - `z` dropped here while still borrowed
 21 | }
    | - borrowed value needs to live until here
 
@@ -28,12 +27,12 @@ error[E0503]: cannot use `x` because it was mutably borrowed
    |             ^^^^^ use of borrowed `x`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/regions-escape-loop-via-vec.rs:18:9
+  --> $DIR/regions-escape-loop-via-vec.rs:19:9
    |
 14 |     let mut _y = vec![&mut x];
    |                            - borrow of `x` occurs here
 ...
-18 |         x += 1; //~ ERROR cannot assign
+19 |         x += 1; //~ ERROR cannot assign
    |         ^^^^^^ assignment to borrowed `x` occurs here
 
 error: aborting due to 4 previous errors