about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2018-03-05 19:29:05 -0300
committerSantiago Pastorino <spastorino@gmail.com>2018-03-06 10:34:46 -0300
commitec761903ec37df5fe6976be1e25079d8f8cbb494 (patch)
tree65305e6b9448ea8e5fb20ca31ce8acdfd860160f
parent6f2100b92cb14fbea2102701af6a3ac5814bd06c (diff)
downloadrust-ec761903ec37df5fe6976be1e25079d8f8cbb494.tar.gz
rust-ec761903ec37df5fe6976be1e25079d8f8cbb494.zip
Remove nll-dump-cause flag and always track causes
-rw-r--r--src/librustc/session/config.rs2
-rw-r--r--src/librustc/session/mod.rs7
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/mod.rs5
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/values.rs9
-rw-r--r--src/test/ui/issue-45157.stderr7
-rw-r--r--src/test/ui/nll/borrowed-local-error.rs2
-rw-r--r--src/test/ui/nll/borrowed-local-error.stderr2
-rw-r--r--src/test/ui/nll/borrowed-match-issue-45045.stderr5
-rw-r--r--src/test/ui/nll/borrowed-referent-issue-38899.stderr3
-rw-r--r--src/test/ui/nll/borrowed-temporary-error.rs2
-rw-r--r--src/test/ui/nll/borrowed-temporary-error.stderr2
-rw-r--r--src/test/ui/nll/borrowed-universal-error-2.rs2
-rw-r--r--src/test/ui/nll/borrowed-universal-error-2.stderr6
-rw-r--r--src/test/ui/nll/borrowed-universal-error.rs2
-rw-r--r--src/test/ui/nll/borrowed-universal-error.stderr6
-rw-r--r--src/test/ui/nll/capture-ref-in-struct.rs2
-rw-r--r--src/test/ui/nll/capture-ref-in-struct.stderr2
-rw-r--r--src/test/ui/nll/closure-requirements/escape-argument.rs2
-rw-r--r--src/test/ui/nll/closure-requirements/escape-upvar-nested.rs2
-rw-r--r--src/test/ui/nll/closure-requirements/escape-upvar-ref.rs2
-rw-r--r--src/test/ui/nll/drop-no-may-dangle.rs2
-rw-r--r--src/test/ui/nll/get_default.rs2
-rw-r--r--src/test/ui/nll/guarantor-issue-46974.stderr2
-rw-r--r--src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs2
-rw-r--r--src/test/ui/nll/maybe-initialized-drop-with-fragment.rs2
-rw-r--r--src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs2
-rw-r--r--src/test/ui/nll/maybe-initialized-drop.rs2
-rw-r--r--src/test/ui/nll/return-ref-mut-issue-46557.stderr15
28 files changed, 46 insertions, 55 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 157614f847a..194b014c97b 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1312,8 +1312,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "choose which RELRO level to use"),
     nll: bool = (false, parse_bool, [UNTRACKED],
                  "run the non-lexical lifetimes MIR pass"),
-    nll_dump_cause: bool = (false, parse_bool, [UNTRACKED],
-                 "dump cause information when reporting errors from NLL"),
     trans_time_graph: bool = (false, parse_bool, [UNTRACKED],
         "generate a graphical HTML report of time spent in trans and LLVM"),
     thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 5e9eeb97300..067e480bd60 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -476,13 +476,6 @@ impl Session {
         *(self.features.borrow_mut()) = Some(features);
     }
 
-    /// If true, we should gather causal information during NLL
-    /// checking. This will eventually be the normal thing, but right
-    /// now it is too unoptimized.
-    pub fn nll_dump_cause(&self) -> bool {
-        self.opts.debugging_opts.nll_dump_cause
-    }
-
     /// Calculates the flavor of LTO to use for this compilation.
     pub fn lto(&self) -> config::Lto {
         // If our target has codegen requirements ignore the command line
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
index 3ffb4370359..2151592fd66 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
@@ -72,8 +72,6 @@ pub struct RegionInferenceContext<'tcx> {
     universal_regions: UniversalRegions<'tcx>,
 }
 
-struct TrackCauses(bool);
-
 struct RegionDefinition<'tcx> {
     /// Why we created this variable. Mostly these will be
     /// `RegionVariableOrigin::NLL`, but some variables get created
@@ -250,15 +248,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
             .map(|origin| RegionDefinition::new(origin))
             .collect();
 
-        let nll_dump_cause = ty::tls::with(|tcx| tcx.sess.nll_dump_cause());
-
         let mut result = Self {
             definitions,
             elements: elements.clone(),
             liveness_constraints: RegionValues::new(
                 elements,
                 num_region_variables,
-                TrackCauses(nll_dump_cause),
             ),
             inferred_values: None,
             constraints: Vec::new(),
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs
index e6f2a43bfc8..74ee04e0fb1 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs
@@ -17,7 +17,7 @@ use rustc::mir::{BasicBlock, Location, Mir};
 use rustc::ty::RegionVid;
 use syntax::codemap::Span;
 
-use super::{Cause, CauseExt, TrackCauses};
+use super::{Cause, CauseExt};
 
 /// Maps between the various kinds of elements of a region value to
 /// the internal indices that w use.
@@ -202,7 +202,6 @@ impl RegionValues {
     pub(super) fn new(
         elements: &Rc<RegionValueElements>,
         num_region_variables: usize,
-        track_causes: TrackCauses,
     ) -> Self {
         assert!(
             elements.num_universal_regions <= num_region_variables,
@@ -215,11 +214,7 @@ impl RegionValues {
                 RegionVid::new(num_region_variables),
                 RegionElementIndex::new(elements.num_elements()),
             ),
-            causes: if track_causes.0 {
-                Some(CauseMap::default())
-            } else {
-                None
-            },
+            causes: Some(CauseMap::default()),
         }
     }
 
diff --git a/src/test/ui/issue-45157.stderr b/src/test/ui/issue-45157.stderr
index 3ce93da6ad5..bec91f7f70d 100644
--- a/src/test/ui/issue-45157.stderr
+++ b/src/test/ui/issue-45157.stderr
@@ -6,6 +6,9 @@ LL |         let mref = &mut u.s.a;
 ...
 LL |         let nref = &u.z.c;
    |                    ^^^^^^ immutable borrow occurs here
+LL |         //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
+LL |         println!("{} {}", mref, nref)
+   |                           ---- borrow later used here
 
 error[E0502]: cannot borrow `u.s.a` as mutable because it is also borrowed as immutable
   --> $DIR/issue-45157.rs:39:27
@@ -14,7 +17,9 @@ LL |         let nref = &u.z.c;
    |                    ------ immutable borrow occurs here
 LL |         //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502]
 LL |         println!("{} {}", mref, nref)
-   |                           ^^^^ mutable borrow occurs here
+   |                           ^^^^  ---- borrow later used here
+   |                           |
+   |                           mutable borrow occurs here
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/nll/borrowed-local-error.rs b/src/test/ui/nll/borrowed-local-error.rs
index 785a38da959..084d0c159ef 100644
--- a/src/test/ui/nll/borrowed-local-error.rs
+++ b/src/test/ui/nll/borrowed-local-error.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Znll-dump-cause
-
 #![feature(nll)]
 
 fn gimme(x: &(u32,)) -> &u32 {
diff --git a/src/test/ui/nll/borrowed-local-error.stderr b/src/test/ui/nll/borrowed-local-error.stderr
index 3bc19785548..24964f651f7 100644
--- a/src/test/ui/nll/borrowed-local-error.stderr
+++ b/src/test/ui/nll/borrowed-local-error.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `v` does not live long enough
-  --> $DIR/borrowed-local-error.rs:22:9
+  --> $DIR/borrowed-local-error.rs:20:9
    |
 LL |       let x = gimme({
    |  _____________-
diff --git a/src/test/ui/nll/borrowed-match-issue-45045.stderr b/src/test/ui/nll/borrowed-match-issue-45045.stderr
index 144eba8cb76..a80bc686e34 100644
--- a/src/test/ui/nll/borrowed-match-issue-45045.stderr
+++ b/src/test/ui/nll/borrowed-match-issue-45045.stderr
@@ -10,6 +10,8 @@ LL | |         //~^ cannot use `e` because it was mutably borrowed [E0503]
 LL | |         Xyz::B => println!("b"),
 LL | |     };
    | |_____^ use of borrowed `e`
+LL |       *g = Xyz::B;
+   |       ----------- borrow later used here
 
 error[E0503]: cannot use `e` because it was mutably borrowed
   --> $DIR/borrowed-match-issue-45045.rs:25:9
@@ -19,6 +21,9 @@ LL |     let f = &mut e;
 ...
 LL |         Xyz::A => println!("a"),
    |         ^^^^^^ use of borrowed `e`
+...
+LL |     *g = Xyz::B;
+   |     ----------- borrow later used here
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.stderr b/src/test/ui/nll/borrowed-referent-issue-38899.stderr
index 91f81783297..675f85ecb4d 100644
--- a/src/test/ui/nll/borrowed-referent-issue-38899.stderr
+++ b/src/test/ui/nll/borrowed-referent-issue-38899.stderr
@@ -6,6 +6,9 @@ LL |     let x = &mut block;
 LL |     println!("{}", x.current);
 LL |     let p: &'a u8 = &*block.current;
    |                     ^^^^^^^^^^^^^^^ immutable borrow occurs here
+LL |     //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+LL |     drop(x);
+   |          - borrow later used here
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/borrowed-temporary-error.rs b/src/test/ui/nll/borrowed-temporary-error.rs
index e1a6112d173..7aad7205a52 100644
--- a/src/test/ui/nll/borrowed-temporary-error.rs
+++ b/src/test/ui/nll/borrowed-temporary-error.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Znll-dump-cause
-
 #![feature(nll)]
 
 fn gimme(x: &(u32,)) -> &u32 {
diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr
index f5cb1dccc37..575d9b5a62d 100644
--- a/src/test/ui/nll/borrowed-temporary-error.stderr
+++ b/src/test/ui/nll/borrowed-temporary-error.stderr
@@ -1,5 +1,5 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowed-temporary-error.rs:22:10
+  --> $DIR/borrowed-temporary-error.rs:20:10
    |
 LL |         &(v,)
    |          ^^^^ temporary value does not live long enough
diff --git a/src/test/ui/nll/borrowed-universal-error-2.rs b/src/test/ui/nll/borrowed-universal-error-2.rs
index da03a9fc39b..9a59cebfccb 100644
--- a/src/test/ui/nll/borrowed-universal-error-2.rs
+++ b/src/test/ui/nll/borrowed-universal-error-2.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Znll-dump-cause
-
 #![feature(nll)]
 #![allow(warnings)]
 
diff --git a/src/test/ui/nll/borrowed-universal-error-2.stderr b/src/test/ui/nll/borrowed-universal-error-2.stderr
index ff999a71e0f..2e4d7cc8f81 100644
--- a/src/test/ui/nll/borrowed-universal-error-2.stderr
+++ b/src/test/ui/nll/borrowed-universal-error-2.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `v` does not live long enough
-  --> $DIR/borrowed-universal-error-2.rs:18:5
+  --> $DIR/borrowed-universal-error-2.rs:16:5
    |
 LL |     &v
    |     ^^ borrowed value does not live long enough
@@ -7,8 +7,8 @@ LL |     //~^ ERROR `v` does not live long enough [E0597]
 LL | }
    | - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 16:1...
-  --> $DIR/borrowed-universal-error-2.rs:16:1
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:1...
+  --> $DIR/borrowed-universal-error-2.rs:14:1
    |
 LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/nll/borrowed-universal-error.rs b/src/test/ui/nll/borrowed-universal-error.rs
index fdc4c29071e..9482b9b1400 100644
--- a/src/test/ui/nll/borrowed-universal-error.rs
+++ b/src/test/ui/nll/borrowed-universal-error.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: -Znll-dump-cause
-
 #![feature(nll)]
 #![allow(warnings)]
 
diff --git a/src/test/ui/nll/borrowed-universal-error.stderr b/src/test/ui/nll/borrowed-universal-error.stderr
index 4a3d0c6d959..3e9a3ceb1db 100644
--- a/src/test/ui/nll/borrowed-universal-error.stderr
+++ b/src/test/ui/nll/borrowed-universal-error.stderr
@@ -1,5 +1,5 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowed-universal-error.rs:22:12
+  --> $DIR/borrowed-universal-error.rs:20:12
    |
 LL |     gimme(&(v,))
    |            ^^^^ temporary value does not live long enough
@@ -7,8 +7,8 @@ LL |     //~^ ERROR borrowed value does not live long enough [E0597]
 LL | }
    | - temporary value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:1...
-  --> $DIR/borrowed-universal-error.rs:20:1
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:1...
+  --> $DIR/borrowed-universal-error.rs:18:1
    |
 LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/nll/capture-ref-in-struct.rs b/src/test/ui/nll/capture-ref-in-struct.rs
index 74b086ab18a..f49e06bd9e8 100644
--- a/src/test/ui/nll/capture-ref-in-struct.rs
+++ b/src/test/ui/nll/capture-ref-in-struct.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-Znll-dump-cause
-
 // Test that a structure which tries to store a pointer to `y` into
 // `p` (indirectly) fails to compile.
 
diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr
index 1c545906893..0fb71807584 100644
--- a/src/test/ui/nll/capture-ref-in-struct.stderr
+++ b/src/test/ui/nll/capture-ref-in-struct.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/capture-ref-in-struct.rs:33:16
+  --> $DIR/capture-ref-in-struct.rs:31:16
    |
 LL |             y: &y,
    |                ^^ borrowed value does not live long enough
diff --git a/src/test/ui/nll/closure-requirements/escape-argument.rs b/src/test/ui/nll/closure-requirements/escape-argument.rs
index 17fadf0a297..7e918c6431d 100644
--- a/src/test/ui/nll/closure-requirements/escape-argument.rs
+++ b/src/test/ui/nll/closure-requirements/escape-argument.rs
@@ -22,7 +22,7 @@
 // basically checking that the MIR type checker correctly enforces the
 // closure signature.
 
-// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
+// compile-flags:-Znll -Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs b/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs
index 984c9fe7c34..05700ae00ad 100644
--- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs
+++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs
@@ -15,7 +15,7 @@
 //
 // except that the closure does so via a second closure.
 
-// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
+// compile-flags:-Znll -Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs
index 499ebd65955..93d8bfafcba 100644
--- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs
+++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs
@@ -19,7 +19,7 @@
 // `'b`.  This relationship is propagated to the closure creator,
 // which reports an error.
 
-// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause -Zverbose
+// compile-flags:-Znll -Zborrowck=mir -Zverbose
 
 #![feature(rustc_attrs)]
 
diff --git a/src/test/ui/nll/drop-no-may-dangle.rs b/src/test/ui/nll/drop-no-may-dangle.rs
index 0220858a0d5..3d9a5456cbb 100644
--- a/src/test/ui/nll/drop-no-may-dangle.rs
+++ b/src/test/ui/nll/drop-no-may-dangle.rs
@@ -13,7 +13,7 @@
 // because of destructor. (Note that the stderr also identifies this
 // destructor in the error message.)
 
-// compile-flags:-Znll -Zborrowck=mir -Znll-dump-cause
+// compile-flags:-Znll -Zborrowck=mir
 
 #![allow(warnings)]
 #![feature(dropck_eyepatch)]
diff --git a/src/test/ui/nll/get_default.rs b/src/test/ui/nll/get_default.rs
index 7c52a0c87af..e5944e75e42 100644
--- a/src/test/ui/nll/get_default.rs
+++ b/src/test/ui/nll/get_default.rs
@@ -13,7 +13,7 @@
 // a variety of errors from the older, AST-based machinery (notably
 // borrowck), and then we get the NLL error at the end.
 
-// compile-flags:-Znll -Zborrowck=compare -Znll-dump-cause
+// compile-flags:-Znll -Zborrowck=compare
 
 struct Map {
 }
diff --git a/src/test/ui/nll/guarantor-issue-46974.stderr b/src/test/ui/nll/guarantor-issue-46974.stderr
index 4bcbb596e5c..82c5e8dafdc 100644
--- a/src/test/ui/nll/guarantor-issue-46974.stderr
+++ b/src/test/ui/nll/guarantor-issue-46974.stderr
@@ -6,6 +6,8 @@ LL |     let t = &mut *s; // this borrow should last for the entire function
 LL |     let x = &t.0;
 LL |     *s = (2,); //~ ERROR cannot assign to `*s`
    |     ^^^^^^^^^ assignment to borrowed `*s` occurs here
+LL |     *x
+   |     -- borrow later used here
 
 error[E0621]: explicit lifetime required in the type of `s`
   --> $DIR/guarantor-issue-46974.rs:25:5
diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs
index 184dfe320d3..d4df2a01c81 100644
--- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs
+++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll -Znll-dump-cause
+//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
 
 
 #![allow(warnings)]
diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs
index beb2c87f8f3..2eb90dca702 100644
--- a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs
+++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
+//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
 
 #![allow(warnings)]
 
diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs
index 39cad8acee1..f639d8f243f 100644
--- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs
+++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
+//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
 
 #![allow(warnings)]
 
diff --git a/src/test/ui/nll/maybe-initialized-drop.rs b/src/test/ui/nll/maybe-initialized-drop.rs
index 767c5b9b8be..c2cc479d28e 100644
--- a/src/test/ui/nll/maybe-initialized-drop.rs
+++ b/src/test/ui/nll/maybe-initialized-drop.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll -Znll-dump-cause
+//compile-flags: -Z emit-end-regions -Zborrowck=mir -Znll
 
 #![allow(warnings)]
 
diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr
index c77e0772ce9..2184beac99b 100644
--- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr
+++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr
@@ -1,11 +1,16 @@
 error[E0597]: borrowed value does not live long enough
   --> $DIR/return-ref-mut-issue-46557.rs:17:21
    |
-LL |     let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
-   |                     ^^^^^^^ temporary value does not live long enough
-LL |     x
-LL | }
-   | - temporary value only lives until here
+LL |   fn gimme_static_mut() -> &'static mut u32 {
+   |  ___________________________________________-
+LL | |     let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
+   | |                     ^^^^^^^ temporary value does not live long enough
+LL | |     x
+LL | | }
+   | | -
+   | | |
+   | |_temporary value only lives until here
+   |   borrow later used here
 
 error: aborting due to previous error