about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-11-02 15:09:41 -0400
committerGitHub <noreply@github.com>2016-11-02 15:09:41 -0400
commitdbb2506b72155e7148eddac0c6e1e84f073089d7 (patch)
tree6ce5a6b5fbb4fc56609ffe3c79854ebfc05720b4
parentd00e5e9343a11939c80c0ade5ca71c8dcbc31847 (diff)
parenta0e7e357a796f93527d0a0e850fa71c48594b91d (diff)
downloadrust-dbb2506b72155e7148eddac0c6e1e84f073089d7.tar.gz
rust-dbb2506b72155e7148eddac0c6e1e84f073089d7.zip
Rollup merge of #37405 - mikhail-m1:dnlle, r=jonathandturner
Improve "Doesn't live long enough" error

case with different lifetime scope

issue #36537 part of #35233
r? @jonathandturner
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs13
-rw-r--r--src/test/ui/span/borrowck-ref-into-rvalue.rs (renamed from src/test/compile-fail/borrowck/borrowck-ref-into-rvalue.rs)0
-rw-r--r--src/test/ui/span/borrowck-ref-into-rvalue.stderr16
-rw-r--r--src/test/ui/span/destructor-restrictions.rs (renamed from src/test/compile-fail/destructor-restrictions.rs)0
-rw-r--r--src/test/ui/span/destructor-restrictions.stderr12
-rw-r--r--src/test/ui/span/issue-11925.stderr4
-rw-r--r--src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr8
-rw-r--r--src/test/ui/span/mut-ptr-cant-outlive-ref.rs (renamed from src/test/compile-fail/mut-ptr-cant-outlive-ref.rs)0
-rw-r--r--src/test/ui/span/mut-ptr-cant-outlive-ref.stderr12
-rw-r--r--src/test/ui/span/range-2.rs (renamed from src/test/compile-fail/range-2.rs)0
-rw-r--r--src/test/ui/span/range-2.stderr24
-rw-r--r--src/test/ui/span/regionck-unboxed-closure-lifetimes.rs (renamed from src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs)0
-rw-r--r--src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr13
-rw-r--r--src/test/ui/span/regions-close-over-type-parameter-2.rs (renamed from src/test/compile-fail/regions-close-over-type-parameter-2.rs)0
-rw-r--r--src/test/ui/span/regions-close-over-type-parameter-2.stderr13
-rw-r--r--src/test/ui/span/regions-escape-loop-via-variable.rs (renamed from src/test/compile-fail/regions-escape-loop-via-variable.rs)0
-rw-r--r--src/test/ui/span/regions-escape-loop-via-variable.stderr12
-rw-r--r--src/test/ui/span/regions-escape-loop-via-vec.rs (renamed from src/test/compile-fail/regions-escape-loop-via-vec.rs)0
-rw-r--r--src/test/ui/span/regions-escape-loop-via-vec.stderr41
-rw-r--r--src/test/ui/span/regions-infer-borrow-scope-within-loop.rs (renamed from src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs)0
-rw-r--r--src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr14
-rw-r--r--src/test/ui/span/send-is-not-static-ensures-scoping.rs (renamed from src/test/compile-fail/send-is-not-static-ensures-scoping.rs)0
-rw-r--r--src/test/ui/span/send-is-not-static-ensures-scoping.stderr28
-rw-r--r--src/test/ui/span/send-is-not-static-std-sync-2.rs (renamed from src/test/compile-fail/send-is-not-static-std-sync-2.rs)0
-rw-r--r--src/test/ui/span/send-is-not-static-std-sync-2.stderr36
-rw-r--r--src/test/ui/span/send-is-not-static-std-sync.rs (renamed from src/test/compile-fail/send-is-not-static-std-sync.rs)0
-rw-r--r--src/test/ui/span/send-is-not-static-std-sync.stderr56
-rw-r--r--src/test/ui/span/wf-method-late-bound-regions.rs (renamed from src/test/compile-fail/wf-method-late-bound-regions.rs)0
-rw-r--r--src/test/ui/span/wf-method-late-bound-regions.stderr13
29 files changed, 309 insertions, 6 deletions
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index ef6936b6e7d..0d084d9b930 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -1064,6 +1064,19 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
                         db.note("values in a scope are dropped in the opposite order \
                                 they are created");
                     }
+                    (Some(s1), Some(s2)) if !is_temporary && !is_closure => {
+                        db.span = MultiSpan::from_span(s2);
+                        db.span_label(error_span, &format!("borrow occurs here"));
+                        let msg = match opt_loan_path(&err.cmt) {
+                            None => "borrowed value".to_string(),
+                            Some(lp) => {
+                                format!("`{}`", self.loan_path_to_string(&lp))
+                            }
+                        };
+                        db.span_label(s2,
+                                      &format!("{} dropped here while still borrowed", msg));
+                        db.span_label(s1, &format!("{} needs to live until here", value_kind));
+                    }
                     _ => {
                         match sub_span {
                             Some(s) => {
diff --git a/src/test/compile-fail/borrowck/borrowck-ref-into-rvalue.rs b/src/test/ui/span/borrowck-ref-into-rvalue.rs
index 726d4bcdf1d..726d4bcdf1d 100644
--- a/src/test/compile-fail/borrowck/borrowck-ref-into-rvalue.rs
+++ b/src/test/ui/span/borrowck-ref-into-rvalue.rs
diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.stderr
new file mode 100644
index 00000000000..adbf39b3f75
--- /dev/null
+++ b/src/test/ui/span/borrowck-ref-into-rvalue.stderr
@@ -0,0 +1,16 @@
+error: borrowed value does not live long enough
+  --> $DIR/borrowck-ref-into-rvalue.rs:18:5
+   |
+14 |         Some(ref m) => { //~ ERROR borrowed value does not live long enough
+   |              ----- borrow occurs here
+...
+18 |     }
+   |     ^ borrowed value dropped here while still borrowed
+19 |     println!("{}", *msg);
+20 | }
+   | - borrowed value needs to live until here
+   |
+   = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/destructor-restrictions.rs b/src/test/ui/span/destructor-restrictions.rs
index 22f615cafd7..22f615cafd7 100644
--- a/src/test/compile-fail/destructor-restrictions.rs
+++ b/src/test/ui/span/destructor-restrictions.rs
diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr
new file mode 100644
index 00000000000..3253212c5b8
--- /dev/null
+++ b/src/test/ui/span/destructor-restrictions.stderr
@@ -0,0 +1,12 @@
+error: `*a` does not live long enough
+  --> $DIR/destructor-restrictions.rs:19:5
+   |
+18 |         *a.borrow() + 1    //~ ERROR `*a` does not live long enough
+   |          - borrow occurs here
+19 |     };
+   |     ^- borrowed value needs to live until here
+   |     |
+   |     `*a` dropped here while still borrowed
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr
index 3fedb2884bc..6ad9c27b8b9 100644
--- a/src/test/ui/span/issue-11925.stderr
+++ b/src/test/ui/span/issue-11925.stderr
@@ -4,8 +4,8 @@ error: `x` does not live long enough
 18 |         let f = to_fn_once(move|| &x);
    |                                    ^
    |                                    |
-   |                                    does not live long enough
-   |                                    borrowed value only lives until here
+   |                                    borrow occurs here
+   |                                    `x` dropped here while still borrowed
 ...
 23 | }
    | - borrowed value needs to live until here
diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
index f10ba0bf221..85a0002f241 100644
--- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
+++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
@@ -9,14 +9,14 @@ error: `y` does not live long enough
    = note: values in a scope are dropped in the opposite order they are created
 
 error: `y` does not live long enough
-  --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9
+  --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:28:5
    |
 27 |         y.borrow().clone() //~ ERROR `y` does not live long enough
-   |         ^ does not live long enough
+   |         - borrow occurs here
 28 |     };
-   |     -- borrowed value needs to live until here
+   |     ^- borrowed value needs to live until here
    |     |
-   |     borrowed value only lives until here
+   |     `y` dropped here while still borrowed
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs
index 8e968d90a2f..8e968d90a2f 100644
--- a/src/test/compile-fail/mut-ptr-cant-outlive-ref.rs
+++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs
diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr
new file mode 100644
index 00000000000..0417eb075af
--- /dev/null
+++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr
@@ -0,0 +1,12 @@
+error: `b` does not live long enough
+  --> $DIR/mut-ptr-cant-outlive-ref.rs:19:5
+   |
+18 |         p = &*b; //~ ERROR `b` does not live long enough
+   |               - borrow occurs here
+19 |     }
+   |     ^ `b` dropped here while still borrowed
+20 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/range-2.rs b/src/test/ui/span/range-2.rs
index 94967693ecf..94967693ecf 100644
--- a/src/test/compile-fail/range-2.rs
+++ b/src/test/ui/span/range-2.rs
diff --git a/src/test/ui/span/range-2.stderr b/src/test/ui/span/range-2.stderr
new file mode 100644
index 00000000000..9f11de77be7
--- /dev/null
+++ b/src/test/ui/span/range-2.stderr
@@ -0,0 +1,24 @@
+error: `a` does not live long enough
+  --> $DIR/range-2.rs:20:5
+   |
+17 |         &a..&b
+   |          - borrow occurs here
+...
+20 |     };
+   |     ^ `a` dropped here while still borrowed
+21 | }
+   | - borrowed value needs to live until here
+
+error: `b` does not live long enough
+  --> $DIR/range-2.rs:20:5
+   |
+17 |         &a..&b
+   |              - borrow occurs here
+...
+20 |     };
+   |     ^ `b` dropped here while still borrowed
+21 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs
index 8ec6036762f..8ec6036762f 100644
--- a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs
+++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs
diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr
new file mode 100644
index 00000000000..9c369e03e33
--- /dev/null
+++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr
@@ -0,0 +1,13 @@
+error: `c` does not live long enough
+  --> $DIR/regionck-unboxed-closure-lifetimes.rs:19:5
+   |
+17 |         let c_ref = &c; //~ ERROR `c` does not live long enough
+   |                      - borrow occurs here
+18 |         f = move |a: isize, b: isize| { a + b + *c_ref };
+19 |     }
+   |     ^ `c` dropped here while still borrowed
+20 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs
index 053af49e068..053af49e068 100644
--- a/src/test/compile-fail/regions-close-over-type-parameter-2.rs
+++ b/src/test/ui/span/regions-close-over-type-parameter-2.rs
diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.stderr
new file mode 100644
index 00000000000..ea652da7da4
--- /dev/null
+++ b/src/test/ui/span/regions-close-over-type-parameter-2.stderr
@@ -0,0 +1,13 @@
+error: `tmp0` does not live long enough
+  --> $DIR/regions-close-over-type-parameter-2.rs:35:5
+   |
+33 |         let tmp1 = &tmp0; //~ ERROR `tmp0` does not live long enough
+   |                     ---- borrow occurs here
+34 |         repeater3(tmp1)
+35 |     };
+   |     ^- borrowed value needs to live until here
+   |     |
+   |     `tmp0` dropped here while still borrowed
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-escape-loop-via-variable.rs b/src/test/ui/span/regions-escape-loop-via-variable.rs
index f588655d1af..f588655d1af 100644
--- a/src/test/compile-fail/regions-escape-loop-via-variable.rs
+++ b/src/test/ui/span/regions-escape-loop-via-variable.rs
diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr
new file mode 100644
index 00000000000..09f2154905f
--- /dev/null
+++ b/src/test/ui/span/regions-escape-loop-via-variable.stderr
@@ -0,0 +1,12 @@
+error: `x` does not live long enough
+  --> $DIR/regions-escape-loop-via-variable.rs:22:5
+   |
+21 |         p = &x; //~ ERROR `x` does not live long enough
+   |              - borrow occurs here
+22 |     }
+   |     ^ `x` dropped here while still borrowed
+23 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs
index 8982b5cd98d..8982b5cd98d 100644
--- a/src/test/compile-fail/regions-escape-loop-via-vec.rs
+++ b/src/test/ui/span/regions-escape-loop-via-vec.rs
diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr
new file mode 100644
index 00000000000..58f7849e443
--- /dev/null
+++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr
@@ -0,0 +1,41 @@
+error: `z` does not live long enough
+  --> $DIR/regions-escape-loop-via-vec.rs:26:5
+   |
+22 |         _y.push(&mut z); //~ ERROR `z` does not live long enough
+   |                      - borrow occurs here
+...
+26 |     }
+   |     ^ `z` dropped here while still borrowed
+27 |     //~^ NOTE borrowed value only lives until here
+28 | }
+   | - borrowed value needs to live until here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+  --> $DIR/regions-escape-loop-via-vec.rs:18:11
+   |
+14 |     let mut _y = vec![&mut x];
+   |                            - borrow of `x` occurs here
+...
+18 |     while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
+   |           ^ use of borrowed `x`
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+  --> $DIR/regions-escape-loop-via-vec.rs:20:13
+   |
+14 |     let mut _y = vec![&mut x];
+   |                            - borrow of `x` occurs here
+...
+20 |         let mut z = x; //~ ERROR 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:24:9
+   |
+14 |     let mut _y = vec![&mut x];
+   |                            - borrow of `x` occurs here
+...
+24 |         x += 1; //~ ERROR cannot assign
+   |         ^^^^^^ assignment to borrowed `x` occurs here
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs
index a05658e9e58..a05658e9e58 100644
--- a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
+++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs
diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr
new file mode 100644
index 00000000000..0e7b64ec2b3
--- /dev/null
+++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr
@@ -0,0 +1,14 @@
+error: `*x` does not live long enough
+  --> $DIR/regions-infer-borrow-scope-within-loop.rs:28:5
+   |
+24 |         y = borrow(&*x); //~ ERROR `*x` does not live long enough
+   |                     -- borrow occurs here
+...
+28 |     }
+   |     ^ `*x` dropped here while still borrowed
+29 |     assert!(*y != 0);
+30 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs b/src/test/ui/span/send-is-not-static-ensures-scoping.rs
index 1b7718d2283..1b7718d2283 100644
--- a/src/test/compile-fail/send-is-not-static-ensures-scoping.rs
+++ b/src/test/ui/span/send-is-not-static-ensures-scoping.rs
diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr
new file mode 100644
index 00000000000..5897921476d
--- /dev/null
+++ b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr
@@ -0,0 +1,28 @@
+error: `x` does not live long enough
+  --> $DIR/send-is-not-static-ensures-scoping.rs:32:5
+   |
+26 |         let y = &x; //~ ERROR `x` does not live long enough
+   |                  - borrow occurs here
+...
+32 |     };
+   |     ^ `x` dropped here while still borrowed
+...
+35 | }
+   | - borrowed value needs to live until here
+
+error: `y` does not live long enough
+  --> $DIR/send-is-not-static-ensures-scoping.rs:29:22
+   |
+28 |         scoped(|| {
+   |                -- capture occurs here
+29 |             let _z = y;
+   |                      ^ does not live long enough
+...
+32 |     };
+   |     - borrowed value only lives until here
+...
+35 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/send-is-not-static-std-sync-2.rs b/src/test/ui/span/send-is-not-static-std-sync-2.rs
index d9d3706586b..d9d3706586b 100644
--- a/src/test/compile-fail/send-is-not-static-std-sync-2.rs
+++ b/src/test/ui/span/send-is-not-static-std-sync-2.rs
diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.stderr
new file mode 100644
index 00000000000..08f85f17bf8
--- /dev/null
+++ b/src/test/ui/span/send-is-not-static-std-sync-2.stderr
@@ -0,0 +1,36 @@
+error: `x` does not live long enough
+  --> $DIR/send-is-not-static-std-sync-2.rs:22:5
+   |
+21 |         Mutex::new(&x) //~ ERROR does not live long enough
+   |                     - borrow occurs here
+22 |     };
+   |     ^ `x` dropped here while still borrowed
+...
+25 | }
+   | - borrowed value needs to live until here
+
+error: `x` does not live long enough
+  --> $DIR/send-is-not-static-std-sync-2.rs:31:5
+   |
+30 |         RwLock::new(&x) //~ ERROR does not live long enough
+   |                      - borrow occurs here
+31 |     };
+   |     ^ `x` dropped here while still borrowed
+32 |     let _dangling = *lock.read().unwrap();
+33 | }
+   | - borrowed value needs to live until here
+
+error: `x` does not live long enough
+  --> $DIR/send-is-not-static-std-sync-2.rs:41:5
+   |
+39 |         let _ = tx.send(&x); //~ ERROR does not live long enough
+   |                          - borrow occurs here
+40 |         (tx, rx)
+41 |     };
+   |     ^ `x` dropped here while still borrowed
+...
+44 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/send-is-not-static-std-sync.rs b/src/test/ui/span/send-is-not-static-std-sync.rs
index 8ec2fe8a1ec..8ec2fe8a1ec 100644
--- a/src/test/compile-fail/send-is-not-static-std-sync.rs
+++ b/src/test/ui/span/send-is-not-static-std-sync.rs
diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr
new file mode 100644
index 00000000000..a86cf1e5884
--- /dev/null
+++ b/src/test/ui/span/send-is-not-static-std-sync.stderr
@@ -0,0 +1,56 @@
+error: `z` does not live long enough
+  --> $DIR/send-is-not-static-std-sync.rs:27:5
+   |
+26 |         *lock.lock().unwrap() = &z; //~ ERROR does not live long enough
+   |                                  - borrow occurs here
+27 |     }
+   |     ^ `z` dropped here while still borrowed
+28 | }
+   | - borrowed value needs to live until here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/send-is-not-static-std-sync.rs:23:10
+   |
+22 |     *lock.lock().unwrap() = &*y;
+   |                              -- borrow of `*y` occurs here
+23 |     drop(y); //~ ERROR cannot move out
+   |          ^ move out of `y` occurs here
+
+error: `z` does not live long enough
+  --> $DIR/send-is-not-static-std-sync.rs:39:5
+   |
+38 |         *lock.write().unwrap() = &z; //~ ERROR does not live long enough
+   |                                   - borrow occurs here
+39 |     }
+   |     ^ `z` dropped here while still borrowed
+40 | }
+   | - borrowed value needs to live until here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/send-is-not-static-std-sync.rs:35:10
+   |
+34 |     *lock.write().unwrap() = &*y;
+   |                               -- borrow of `*y` occurs here
+35 |     drop(y); //~ ERROR cannot move out
+   |          ^ move out of `y` occurs here
+
+error: `z` does not live long enough
+  --> $DIR/send-is-not-static-std-sync.rs:53:5
+   |
+52 |         tx.send(&z).unwrap(); //~ ERROR does not live long enough
+   |                  - borrow occurs here
+53 |     }
+   |     ^ `z` dropped here while still borrowed
+54 | }
+   | - borrowed value needs to live until here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+  --> $DIR/send-is-not-static-std-sync.rs:49:10
+   |
+48 |     tx.send(&*y);
+   |              -- borrow of `*y` occurs here
+49 |     drop(y); //~ ERROR cannot move out
+   |          ^ move out of `y` occurs here
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/compile-fail/wf-method-late-bound-regions.rs b/src/test/ui/span/wf-method-late-bound-regions.rs
index b9d292fd156..b9d292fd156 100644
--- a/src/test/compile-fail/wf-method-late-bound-regions.rs
+++ b/src/test/ui/span/wf-method-late-bound-regions.rs
diff --git a/src/test/ui/span/wf-method-late-bound-regions.stderr b/src/test/ui/span/wf-method-late-bound-regions.stderr
new file mode 100644
index 00000000000..aeac3102fbf
--- /dev/null
+++ b/src/test/ui/span/wf-method-late-bound-regions.stderr
@@ -0,0 +1,13 @@
+error: `pointer` does not live long enough
+  --> $DIR/wf-method-late-bound-regions.rs:31:5
+   |
+30 |         f2.xmute(&pointer) //~ ERROR `pointer` does not live long enough
+   |                   ------- borrow occurs here
+31 |     };
+   |     ^ `pointer` dropped here while still borrowed
+32 |     println!("{}", dangling);
+33 | }
+   | - borrowed value needs to live until here
+
+error: aborting due to previous error
+