]> git.lizzy.rs Git - rust.git/commitdiff
Point at var in short lived borrows
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 14 Dec 2017 01:27:23 +0000 (17:27 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Fri, 15 Dec 2017 06:45:45 +0000 (22:45 -0800)
82 files changed:
src/librustc_borrowck/borrowck/mod.rs
src/test/ui/dropck/dropck-eyepatch-extern-crate.rs
src/test/ui/dropck/dropck-eyepatch-extern-crate.stderr
src/test/ui/dropck/dropck-eyepatch-reorder.rs
src/test/ui/dropck/dropck-eyepatch-reorder.stderr
src/test/ui/dropck/dropck-eyepatch.rs
src/test/ui/dropck/dropck-eyepatch.stderr
src/test/ui/generator/borrowing.stderr
src/test/ui/generator/ref-escapes-but-not-over-yield.rs
src/test/ui/generator/ref-escapes-but-not-over-yield.stderr
src/test/ui/issue-46471-1.stderr
src/test/ui/issue-46471.stderr
src/test/ui/issue-46472.stderr
src/test/ui/lifetimes/borrowck-let-suggestion.rs
src/test/ui/lifetimes/borrowck-let-suggestion.stderr
src/test/ui/span/borrowck-let-suggestion-suffixes.rs
src/test/ui/span/borrowck-ref-into-rvalue.rs
src/test/ui/span/borrowck-ref-into-rvalue.stderr
src/test/ui/span/destructor-restrictions.rs
src/test/ui/span/destructor-restrictions.stderr
src/test/ui/span/dropck_arr_cycle_checked.rs
src/test/ui/span/dropck_arr_cycle_checked.stderr
src/test/ui/span/dropck_direct_cycle_with_drop.rs
src/test/ui/span/dropck_direct_cycle_with_drop.stderr
src/test/ui/span/dropck_misc_variants.rs
src/test/ui/span/dropck_misc_variants.stderr
src/test/ui/span/dropck_vec_cycle_checked.rs
src/test/ui/span/dropck_vec_cycle_checked.stderr
src/test/ui/span/issue-11925.stderr
src/test/ui/span/issue-15480.rs
src/test/ui/span/issue-15480.stderr
src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs
src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr
src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs
src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr
src/test/ui/span/issue-24805-dropck-trait-has-items.rs
src/test/ui/span/issue-24805-dropck-trait-has-items.stderr
src/test/ui/span/issue-24895-copy-clone-dropck.rs
src/test/ui/span/issue-24895-copy-clone-dropck.stderr
src/test/ui/span/issue-25199.rs
src/test/ui/span/issue-25199.stderr
src/test/ui/span/issue-26656.rs
src/test/ui/span/issue-26656.stderr
src/test/ui/span/issue-29106.rs
src/test/ui/span/issue-29106.stderr
src/test/ui/span/issue-40157.stderr
src/test/ui/span/issue28498-reject-ex1.rs
src/test/ui/span/issue28498-reject-ex1.stderr
src/test/ui/span/issue28498-reject-lifetime-param.rs
src/test/ui/span/issue28498-reject-lifetime-param.stderr
src/test/ui/span/issue28498-reject-passed-to-fn.rs
src/test/ui/span/issue28498-reject-passed-to-fn.stderr
src/test/ui/span/issue28498-reject-trait-bound.rs
src/test/ui/span/issue28498-reject-trait-bound.stderr
src/test/ui/span/mut-ptr-cant-outlive-ref.rs
src/test/ui/span/mut-ptr-cant-outlive-ref.stderr
src/test/ui/span/range-2.rs
src/test/ui/span/range-2.stderr
src/test/ui/span/regionck-unboxed-closure-lifetimes.rs
src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr
src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs
src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr
src/test/ui/span/regions-close-over-type-parameter-2.rs
src/test/ui/span/regions-close-over-type-parameter-2.stderr
src/test/ui/span/regions-escape-loop-via-variable.rs
src/test/ui/span/regions-escape-loop-via-variable.stderr
src/test/ui/span/regions-infer-borrow-scope-within-loop.rs
src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr
src/test/ui/span/send-is-not-static-ensures-scoping.rs
src/test/ui/span/send-is-not-static-ensures-scoping.stderr
src/test/ui/span/send-is-not-static-std-sync-2.rs
src/test/ui/span/send-is-not-static-std-sync-2.stderr
src/test/ui/span/send-is-not-static-std-sync.rs
src/test/ui/span/send-is-not-static-std-sync.stderr
src/test/ui/span/slice-borrow.rs
src/test/ui/span/slice-borrow.stderr
src/test/ui/span/vec-must-not-hide-type-from-dropck.rs
src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr
src/test/ui/span/vec_refs_data_with_early_death.rs
src/test/ui/span/vec_refs_data_with_early_death.stderr
src/test/ui/span/wf-method-late-bound-regions.rs
src/test/ui/span/wf-method-late-bound-regions.stderr

index 40837c5e8d699ea8f7d3c094f5ed58f45b4fdd68..62736db9260ac4ca2671e4e1c9cdcc8d762904b1 100644 (file)
@@ -919,11 +919,9 @@ fn report_bckerr(&self, err: &BckError<'tcx>) {
                 }
 
                 let mut db = self.path_does_not_live_long_enough(error_span, &msg, Origin::Ast);
-                let (value_kind, value_msg) = match err.cmt.cat {
-                    mc::Categorization::Rvalue(..) =>
-                        ("temporary value", "temporary value created here"),
-                    _ =>
-                        ("borrowed value", "borrow occurs here")
+                let value_kind = match err.cmt.cat {
+                    mc::Categorization::Rvalue(..) => "temporary value",
+                    _ => "borrowed value",
                 };
 
                 let is_closure = match cause {
@@ -936,14 +934,16 @@ fn report_bckerr(&self, err: &BckError<'tcx>) {
                             Some(primary) => {
                                 db.span = MultiSpan::from_span(s);
                                 db.span_label(primary, "capture occurs here");
-                                db.span_label(s, "does not live long enough");
+                                db.span_label(s, format!("{} does not live long enough",
+                                                         value_kind));
                                 true
                             }
                             None => false
                         }
                     }
                     _ => {
-                        db.span_label(error_span, "does not live long enough");
+                        db.span_label(error_span, format!("{} does not live long enough",
+                                                          value_kind));
                         false
                     }
                 };
@@ -954,8 +954,6 @@ fn report_bckerr(&self, err: &BckError<'tcx>) {
                 match (sub_span, super_span) {
                     (Some(s1), Some(s2)) if s1 == s2 => {
                         if !is_closure {
-                            db.span = MultiSpan::from_span(s1);
-                            db.span_label(error_span, value_msg);
                             let msg = match opt_loan_path(&err.cmt) {
                                 None => value_kind.to_string(),
                                 Some(lp) => {
@@ -971,8 +969,6 @@ fn report_bckerr(&self, err: &BckError<'tcx>) {
                                 they are created");
                     }
                     (Some(s1), Some(s2)) if !is_closure => {
-                        db.span = MultiSpan::from_span(s2);
-                        db.span_label(error_span, value_msg);
                         let msg = match opt_loan_path(&err.cmt) {
                             None => value_kind.to_string(),
                             Some(lp) => {
index f76c2251f8c707fd35fc34cbac534b066101bd59..4f88b0e6fccf62ba68ebc882f1913cd79bfa346c 100644 (file)
@@ -37,7 +37,9 @@ fn main() {
     dr = Dr("dr", &c_long);
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
+    //~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
+    //~^ ERROR `c` does not live long enough
 
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c, &c_long);
@@ -45,14 +47,13 @@ fn main() {
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c);
+    //~^ ERROR `c` does not live long enough
     pr = Pr("pr", &c_long, &c);
+    //~^ ERROR `c` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c);
     sr = Sr("sr", &c);
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
-}//~ ERROR `c` does not live long enough
-//~^ ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
+}
index 43d5294c93a05e2901248b3f2c04a4f8dad8039c..8aa4fba70852637ef196d19927f253578cfbdbf9 100644 (file)
@@ -1,44 +1,44 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:55:1
+  --> $DIR/dropck-eyepatch-extern-crate.rs:39:20
    |
 39 |     dt = Dt("dt", &c);
-   |                    - borrow occurs here
+   |                    ^ borrowed value does not live long enough
 ...
-55 | }//~ ERROR `c` does not live long enough
-   | ^ `c` dropped here while still borrowed
+59 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:55:1
+  --> $DIR/dropck-eyepatch-extern-crate.rs:41:20
    |
-40 |     dr = Dr("dr", &c);
-   |                    - borrow occurs here
+41 |     dr = Dr("dr", &c);
+   |                    ^ borrowed value does not live long enough
 ...
-55 | }//~ ERROR `c` does not live long enough
-   | ^ `c` dropped here while still borrowed
+59 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:55:1
+  --> $DIR/dropck-eyepatch-extern-crate.rs:49:29
    |
-47 |     pt = Pt("pt", &c_long, &c);
-   |                             - borrow occurs here
+49 |     pt = Pt("pt", &c_long, &c);
+   |                             ^ borrowed value does not live long enough
 ...
-55 | }//~ ERROR `c` does not live long enough
-   | ^ `c` dropped here while still borrowed
+59 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-extern-crate.rs:55:1
+  --> $DIR/dropck-eyepatch-extern-crate.rs:51:29
    |
-48 |     pr = Pr("pr", &c_long, &c);
-   |                             - borrow occurs here
+51 |     pr = Pr("pr", &c_long, &c);
+   |                             ^ borrowed value does not live long enough
 ...
-55 | }//~ ERROR `c` does not live long enough
-   | ^ `c` dropped here while still borrowed
+59 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 95ee45a6117c761593113bfb16cbd5cf4d226805..3bd9efb32b3b4fba046645a2072e66375638b1fc 100644 (file)
@@ -55,7 +55,9 @@ fn main() {
     dr = Dr("dr", &c_long);
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
+    //~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
+    //~^ ERROR `c` does not live long enough
 
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c, &c_long);
@@ -63,7 +65,9 @@ fn main() {
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c);
+    //~^ ERROR `c` does not live long enough
     pr = Pr("pr", &c_long, &c);
+    //~^ ERROR `c` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c);
@@ -71,7 +75,3 @@ fn main() {
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
 }
-//~^ ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
index 1ca456c7ba38b5578152ee7afbb057d0a1430fff..4fa188908fddbf771ac0852be980132ea9b9a782 100644 (file)
@@ -1,44 +1,44 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:73:1
+  --> $DIR/dropck-eyepatch-reorder.rs:57:20
    |
 57 |     dt = Dt("dt", &c);
-   |                    - borrow occurs here
+   |                    ^ borrowed value does not live long enough
 ...
-73 | }
-   | ^ `c` dropped here while still borrowed
+77 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:73:1
+  --> $DIR/dropck-eyepatch-reorder.rs:59:20
    |
-58 |     dr = Dr("dr", &c);
-   |                    - borrow occurs here
+59 |     dr = Dr("dr", &c);
+   |                    ^ borrowed value does not live long enough
 ...
-73 | }
-   | ^ `c` dropped here while still borrowed
+77 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:73:1
+  --> $DIR/dropck-eyepatch-reorder.rs:67:29
    |
-65 |     pt = Pt("pt", &c_long, &c);
-   |                             - borrow occurs here
+67 |     pt = Pt("pt", &c_long, &c);
+   |                             ^ borrowed value does not live long enough
 ...
-73 | }
-   | ^ `c` dropped here while still borrowed
+77 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch-reorder.rs:73:1
+  --> $DIR/dropck-eyepatch-reorder.rs:69:29
    |
-66 |     pr = Pr("pr", &c_long, &c);
-   |                             - borrow occurs here
+69 |     pr = Pr("pr", &c_long, &c);
+   |                             ^ borrowed value does not live long enough
 ...
-73 | }
-   | ^ `c` dropped here while still borrowed
+77 | }
+   | - `c` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index de94954e9218b3b7d82733e9b3201b205e08aa30..abaae47189f8bf77703a1b1c8a25b44a80a4a17b 100644 (file)
@@ -78,7 +78,9 @@ fn main() {
     dr = Dr("dr", &c_long);
     // Error: destructor order imprecisely modelled
     dt = Dt("dt", &c);
+    //~^ ERROR `c` does not live long enough
     dr = Dr("dr", &c);
+    //~^ ERROR `c` does not live long enough
 
     // No error: Drop impl asserts .1 (A and &'a _) are not accessed
     pt = Pt("pt", &c, &c_long);
@@ -86,7 +88,9 @@ fn main() {
 
     // Error: Drop impl's assertion does not apply to `B` nor `&'b _`
     pt = Pt("pt", &c_long, &c);
+    //~^ ERROR `c` does not live long enough
     pr = Pr("pr", &c_long, &c);
+    //~^ ERROR `c` does not live long enough
 
     // No error: St and Sr have no destructor.
     st = St("st", &c);
@@ -94,7 +98,3 @@ fn main() {
 
     println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0));
 }
-//~^ ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
-//~| ERROR `c` does not live long enough
index d41ff3741197652fb8049e52328e80b1c9b71e5b..79fb9222d5ca3438e1b27d2716f8b97f50ac6147 100644 (file)
@@ -1,46 +1,46 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:96:1
-   |
-80 |     dt = Dt("dt", &c);
-   |                    - borrow occurs here
+   --> $DIR/dropck-eyepatch.rs:80:20
+    |
+80  |     dt = Dt("dt", &c);
+    |                    ^ borrowed value does not live long enough
 ...
-96 | }
-   | ^ `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
+100 | }
+    | - `c` dropped here while still borrowed
+    |
+    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:96:1
-   |
-81 |     dr = Dr("dr", &c);
-   |                    - borrow occurs here
+   --> $DIR/dropck-eyepatch.rs:82:20
+    |
+8 |     dr = Dr("dr", &c);
+    |                    ^ borrowed value does not live long enough
 ...
-96 | }
-   | ^ `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
+100 | }
+    | - `c` dropped here while still borrowed
+    |
+    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:96:1
-   |
-88 |     pt = Pt("pt", &c_long, &c);
-   |                             - borrow occurs here
+   --> $DIR/dropck-eyepatch.rs:90:29
+    |
+90  |     pt = Pt("pt", &c_long, &c);
+    |                             ^ borrowed value does not live long enough
 ...
-96 | }
-   | ^ `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
+100 | }
+    | - `c` dropped here while still borrowed
+    |
+    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c` does not live long enough
-  --> $DIR/dropck-eyepatch.rs:96:1
-   |
-89 |     pr = Pr("pr", &c_long, &c);
-   |                             - borrow occurs here
+   --> $DIR/dropck-eyepatch.rs:92:29
+    |
+92  |     pr = Pr("pr", &c_long, &c);
+    |                             ^ borrowed value does not live long enough
 ...
-96 | }
-   | ^ `c` dropped here while still borrowed
-   |
-   = note: values in a scope are dropped in the opposite order they are created
+100 | }
+    | - `c` dropped here while still borrowed
+    |
+    = note: values in a scope are dropped in the opposite order they are created
 
 error: aborting due to 4 previous errors
 
index 0ed7e1f99027d64e717775e2f9dc3764bf5e1dfc..cb84eaedb3354836a8b73532a077702c12e12e8b 100644 (file)
@@ -2,7 +2,7 @@ error[E0597]: `a` does not live long enough
   --> $DIR/borrowing.rs:18:20
    |
 18 |         (|| yield &a).resume()
-   |          --        ^ does not live long enough
+   |          --        ^ borrowed value does not live long enough
    |          |
    |          capture occurs here
 19 |         //~^ ERROR: `a` does not live long enough
@@ -18,7 +18,7 @@ error[E0597]: `a` does not live long enough
 24 |         || {
    |         -- capture occurs here
 25 |             yield &a
-   |                    ^ does not live long enough
+   |                    ^ borrowed value does not live long enough
 ...
 28 |     };
    |     - borrowed value only lives until here
index 299106bd552f2e37ae87354389ce745aeae718a7..989949cd9d75a63fc370b7be24c28c76d3685583 100644 (file)
@@ -22,7 +22,8 @@ fn foo(x: &i32) {
         yield();
         let b = 5;
         a = &b;
-    }; //~ ERROR
+        //~^ ERROR `b` does not live long enough
+    };
 }
 
 fn main() { }
index 7310e54925ff89b435acc6c48a8f291c145c9568..fbb72884156ba9f968391bc4818050e0d81b6f82 100644 (file)
@@ -1,11 +1,12 @@
 error[E0597]: `b` does not live long enough
-  --> $DIR/ref-escapes-but-not-over-yield.rs:25:5
+  --> $DIR/ref-escapes-but-not-over-yield.rs:24:14
    |
 24 |         a = &b;
-   |              - borrow occurs here
-25 |     }; //~ ERROR
-   |     ^ `b` dropped here while still borrowed
-26 | }
+   |              ^ borrowed value does not live long enough
+25 |         //~^ ERROR `b` does not live long enough
+26 |     };
+   |     - `b` dropped here while still borrowed
+27 | }
    | - borrowed value needs to live until here
 
 error: aborting due to previous error
index c33b9a7ba7b51d37406776368f28664855f83eae..466ae501a320a5f268568b08eef0962f9bd1e889 100644 (file)
@@ -1,10 +1,10 @@
 error[E0597]: `z` does not live long enough (Ast)
-  --> $DIR/issue-46471-1.rs:17:5
+  --> $DIR/issue-46471-1.rs:16:14
    |
 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
index dd361841de1a219e9dd29b4e79fe497ecb5e0530..bddd1a9f232bba9f9935d46b4dc8bb196e1984d1 100644 (file)
@@ -2,7 +2,7 @@ error[E0597]: `x` does not live long enough (Ast)
   --> $DIR/issue-46471.rs:15:6
    |
 15 |     &x
-   |      ^ does not live long enough
+   |      ^ borrowed value does not live long enough
 ...
 18 | }
    | - borrowed value only lives until here
index ab35874fbb9692da809ce261db66e6693b07393f..a6bde956fca62beaf932f02833185c46c162122a 100644 (file)
@@ -2,7 +2,7 @@ error[E0597]: borrowed value does not live long enough (Ast)
   --> $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
index 7bf0ed34cbfd24c3dad91630fc7b2b70589f3bc5..1c904648f9e7b9827edb922dc8b7ce0b9663c4d4 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn f() {
-    let x = vec![1].iter(); //~ ERROR does not live long enough
+    let x = vec![1].iter();
 }
 
 fn main() {
index 675974d617cb20f9e229421be7706e47a103654b..66be3f964ec5e80660927e91254f0a8941263d90 100644 (file)
@@ -1,10 +1,10 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-let-suggestion.rs:12:27
+  --> $DIR/borrowck-let-suggestion.rs:12:13
    |
-12 |     let x = vec![1].iter(); //~ ERROR does not live long enough
-   |             -------       ^ temporary value dropped here while still borrowed
+12 |     let x = vec![1].iter();
+   |             ^^^^^^^       - temporary value dropped here while still borrowed
    |             |
-   |             temporary value created here
+   |             temporary value does not live long enough
 13 | }
    | - temporary value needs to live until here
    |
index 2bbfd4517b05a57d542eddb46f95122e212094b3..5d7d1cd30c0cd8349f9e553f11e25577fea8fd93 100644 (file)
@@ -19,11 +19,17 @@ fn f() {
     let young = ['y'];       // statement 3
 
     v2.push(&young[0]);      // statement 4
+    //~^ ERROR `young[..]` does not live long enough
+    //~| NOTE borrowed value does not live long enough
+    //~| NOTE values in a scope are dropped in the opposite order they are created
 
     let mut v3 = Vec::new(); // statement 5
 
     v3.push(&id('x'));           // statement 6
     //~^ ERROR borrowed value does not live long enough
+    //~| NOTE temporary value does not live long enough
+    //~| NOTE temporary value dropped here while still borrowed
+    //~| NOTE consider using a `let` binding to increase its lifetime
 
     {
 
@@ -31,6 +37,9 @@ fn f() {
 
         v4.push(&id('y'));
         //~^ ERROR borrowed value does not live long enough
+        //~| NOTE temporary value does not live long enough
+        //~| NOTE temporary value dropped here while still borrowed
+        //~| NOTE consider using a `let` binding to increase its lifetime
 
     }                       // (statement 7)
 
@@ -38,10 +47,15 @@ fn f() {
 
     v5.push(&id('z'));
     //~^ ERROR borrowed value does not live long enough
+    //~| NOTE temporary value does not live long enough
+    //~| NOTE temporary value dropped here while still borrowed
+    //~| NOTE consider using a `let` binding to increase its lifetime
 
     v1.push(&old[0]);
 }
-//~^ ERROR `young[..]` does not live long enough
+//~^ NOTE `young[..]` dropped here while still borrowed
+//~| NOTE temporary value needs to live until here
+//~| NOTE temporary value needs to live until here
 
 fn main() {
     f();
index a059232daca387cc60cbbcd0041ac3198b6f1bd2..7f07a09358ab614488c10df0daade86353a7e8f3 100644 (file)
@@ -12,9 +12,10 @@ fn main() {
     let msg;
     match Some("Hello".to_string()) {
         Some(ref m) => {
+        //~^ ERROR borrowed value does not live long enough
             msg = m;
         },
         None => { panic!() }
-    } //~ ERROR borrowed value does not live long enough
+    }
     println!("{}", *msg);
 }
index 91f9cddd5898563426c472d9c1cf93be96ddce1f..80ddd150757e6c0357432c9dea6e238e9d9b2ee7 100644 (file)
@@ -1,13 +1,13 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-ref-into-rvalue.rs:18:5
+  --> $DIR/borrowck-ref-into-rvalue.rs:14:14
    |
 14 |         Some(ref m) => {
-   |              ----- borrow occurs here
+   |              ^^^^^ borrowed value does not live long enough
 ...
-18 |     } //~ ERROR borrowed value does not live long enough
-   |     ^ borrowed value dropped here while still borrowed
-19 |     println!("{}", *msg);
-20 | }
+19 |     }
+   |     - borrowed value dropped here while still borrowed
+20 |     println!("{}", *msg);
+21 | }
    | - borrowed value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
index 7c80867856d3bb6befc2bb3d311ef97b2d26a3c3..d20194422f737a1a60fa0ab10de83c73996b092d 100644 (file)
@@ -16,6 +16,6 @@ fn main() {
     let b = {
         let a = Box::new(RefCell::new(4));
         *a.borrow() + 1
-    }; //~ ERROR `*a` does not live long enough
+    }; //~^ ERROR `*a` does not live long enough
     println!("{}", b);
 }
index e6d24d7c135991e2e780187ba4f0b715323eb47c..abe982c5ce3c16faeb27df6601170108082d190c 100644 (file)
@@ -1,10 +1,10 @@
 error[E0597]: `*a` does not live long enough
-  --> $DIR/destructor-restrictions.rs:19:5
+  --> $DIR/destructor-restrictions.rs:18:10
    |
 18 |         *a.borrow() + 1
-   |          - borrow occurs here
-19 |     }; //~ ERROR `*a` does not live long enough
-   |     ^- borrowed value needs to live until here
+   |          ^ borrowed value does not live long enough
+19 |     }; //~^ ERROR `*a` does not live long enough
+   |     -- borrowed value needs to live until here
    |     |
    |     `*a` dropped here while still borrowed
 
index 455c9dc57f52be87c55f713988d8a23da15489e2..6bf2ae978a0dcba5545c0aca03be81e4eab87005 100644 (file)
@@ -101,18 +101,18 @@ fn f() {
     b2 = B::new();
     b3 = B::new();
     b1.a[0].v.set(Some(&b2));
+    //~^ ERROR `b2` does not live long enough
     b1.a[1].v.set(Some(&b3));
+    //~^ ERROR `b3` does not live long enough
     b2.a[0].v.set(Some(&b2));
+    //~^ ERROR `b2` does not live long enough
     b2.a[1].v.set(Some(&b3));
+    //~^ ERROR `b3` does not live long enough
     b3.a[0].v.set(Some(&b1));
+    //~^ ERROR `b1` does not live long enough
     b3.a[1].v.set(Some(&b2));
+    //~^ ERROR `b2` does not live long enough
 }
-//~^ ERROR `b2` does not live long enough
-//~| ERROR `b3` does not live long enough
-//~| ERROR `b2` does not live long enough
-//~| ERROR `b3` does not live long enough
-//~| ERROR `b1` does not live long enough
-//~| ERROR `b2` does not live long enough
 
 fn main() {
     f();
index 4179ac1a94605ecb067775af2f562b4c009b430b..1225c36ab3de344c1f7c444d2ec4e5f9d1d96eeb 100644 (file)
@@ -1,65 +1,66 @@
 error[E0597]: `b2` does not live long enough
-   --> $DIR/dropck_arr_cycle_checked.rs:109:1
+   --> $DIR/dropck_arr_cycle_checked.rs:103:25
     |
 103 |     b1.a[0].v.set(Some(&b2));
-    |                         -- borrow occurs here
+    |                         ^^ borrowed value does not live long enough
 ...
-109 | }
-    | ^ `b2` dropped here while still borrowed
+115 | }
+    | - `b2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `b3` does not live long enough
-   --> $DIR/dropck_arr_cycle_checked.rs:109:1
+   --> $DIR/dropck_arr_cycle_checked.rs:105:25
     |
-104 |     b1.a[1].v.set(Some(&b3));
-    |                         -- borrow occurs here
+105 |     b1.a[1].v.set(Some(&b3));
+    |                         ^^ borrowed value does not live long enough
 ...
-109 | }
-    | ^ `b3` dropped here while still borrowed
+115 | }
+    | - `b3` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `b2` does not live long enough
-   --> $DIR/dropck_arr_cycle_checked.rs:109:1
+   --> $DIR/dropck_arr_cycle_checked.rs:107:25
     |
-105 |     b2.a[0].v.set(Some(&b2));
-    |                         -- borrow occurs here
+107 |     b2.a[0].v.set(Some(&b2));
+    |                         ^^ borrowed value does not live long enough
 ...
-109 | }
-    | ^ `b2` dropped here while still borrowed
+115 | }
+    | - `b2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `b3` does not live long enough
-   --> $DIR/dropck_arr_cycle_checked.rs:109:1
+   --> $DIR/dropck_arr_cycle_checked.rs:109:25
     |
-106 |     b2.a[1].v.set(Some(&b3));
-    |                         -- borrow occurs here
+109 |     b2.a[1].v.set(Some(&b3));
+    |                         ^^ borrowed value does not live long enough
 ...
-109 | }
-    | ^ `b3` dropped here while still borrowed
+115 | }
+    | - `b3` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `b1` does not live long enough
-   --> $DIR/dropck_arr_cycle_checked.rs:109:1
+   --> $DIR/dropck_arr_cycle_checked.rs:111:25
     |
-107 |     b3.a[0].v.set(Some(&b1));
-    |                         -- borrow occurs here
-108 |     b3.a[1].v.set(Some(&b2));
-109 | }
-    | ^ `b1` dropped here while still borrowed
+111 |     b3.a[0].v.set(Some(&b1));
+    |                         ^^ borrowed value does not live long enough
+...
+115 | }
+    | - `b1` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `b2` does not live long enough
-   --> $DIR/dropck_arr_cycle_checked.rs:109:1
+   --> $DIR/dropck_arr_cycle_checked.rs:113:25
     |
-108 |     b3.a[1].v.set(Some(&b2));
-    |                         -- borrow occurs here
-109 | }
-    | ^ `b2` dropped here while still borrowed
+113 |     b3.a[1].v.set(Some(&b2));
+    |                         ^^ borrowed value does not live long enough
+114 |     //~^ ERROR `b2` does not live long enough
+115 | }
+    | - `b2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
index 6d13dfc7a794f794c8386997d9cd88418a197d59..0c6ebd5c8d8142cc3ff7fffbb6a76bedab175b76 100644 (file)
@@ -44,10 +44,10 @@ fn drop(&mut self) {
 fn g() {
     let (d1, d2) = (D::new(format!("d1")), D::new(format!("d2")));
     d1.p.set(Some(&d2));
+    //~^ ERROR `d2` does not live long enough
     d2.p.set(Some(&d1));
+    //~^ ERROR `d1` does not live long enough
 }
-//~^ ERROR `d2` does not live long enough
-//~| ERROR `d1` does not live long enough
 
 fn main() {
     g();
index 597d42aabd2d7000923ead130a0e2613a7d3ab9c..462b291f4fad002c7640bc5f2ab6a2cd316ad51d 100644 (file)
@@ -1,21 +1,22 @@
 error[E0597]: `d2` does not live long enough
-  --> $DIR/dropck_direct_cycle_with_drop.rs:48:1
+  --> $DIR/dropck_direct_cycle_with_drop.rs:46:20
    |
 46 |     d1.p.set(Some(&d2));
-   |                    -- borrow occurs here
-47 |     d2.p.set(Some(&d1));
-48 | }
-   | ^ `d2` dropped here while still borrowed
+   |                    ^^ borrowed value does not live long enough
+...
+50 | }
+   | - `d2` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `d1` does not live long enough
-  --> $DIR/dropck_direct_cycle_with_drop.rs:48:1
+  --> $DIR/dropck_direct_cycle_with_drop.rs:48:20
    |
-47 |     d2.p.set(Some(&d1));
-   |                    -- borrow occurs here
-48 | }
-   | ^ `d1` dropped here while still borrowed
+48 |     d2.p.set(Some(&d1));
+   |                    ^^ borrowed value does not live long enough
+49 |     //~^ ERROR `d1` does not live long enough
+50 | }
+   | - `d1` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 7b94eb10dfc6ee61e996559f4017dd883dd3e31d..a98cce32e9d7af16fff4c6aefdd067751399a9fb 100644 (file)
@@ -32,16 +32,16 @@ fn projection() {
     bomb = vec![""];
     _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
 }
-//~^ ERROR `bomb` does not live long enough
+//~^^ ERROR `bomb` does not live long enough
 
 fn closure() {
     let (_w,v);
     v = vec![""];
     _w = {
         let u = NoisyDrop(&v);
+        //~^ ERROR `v` does not live long enough
         move || u.0.len()
     };
 }
-//~^ ERROR `v` does not live long enough
 
 fn main() { closure(); projection() }
index 958f229f659ea03b0c261b687d27ab977199c4a0..b839701f08b91bda8ad9a7c8a7ed2561a3a011bf 100644 (file)
@@ -1,21 +1,21 @@
 error[E0597]: `bomb` does not live long enough
-  --> $DIR/dropck_misc_variants.rs:34:1
+  --> $DIR/dropck_misc_variants.rs:33:37
    |
 33 |     _w = Wrap::<&[&str]>(NoisyDrop(&bomb));
-   |                                     ---- borrow occurs here
+   |                                     ^^^^ borrowed value does not live long enough
 34 | }
-   | ^ `bomb` dropped here while still borrowed
+   | - `bomb` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `v` does not live long enough
-  --> $DIR/dropck_misc_variants.rs:44:1
+  --> $DIR/dropck_misc_variants.rs:41:28
    |
 41 |         let u = NoisyDrop(&v);
-   |                            - borrow occurs here
+   |                            ^ borrowed value does not live long enough
 ...
-44 | }
-   | ^ `v` dropped here while still borrowed
+45 | }
+   | - `v` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 5e7cb79680c1e99797d81690cd1973bd993504ae..0560900e85855c9c2da18f13eeb7970a31cbd52d 100644 (file)
@@ -108,18 +108,18 @@ fn f() {
     c3.v.push(CheckId(Cell::new(None)));
 
     c1.v[0].v.set(Some(&c2));
+    //~^ ERROR `c2` does not live long enough
     c1.v[1].v.set(Some(&c3));
+    //~^ ERROR `c3` does not live long enough
     c2.v[0].v.set(Some(&c2));
+    //~^ ERROR `c2` does not live long enough
     c2.v[1].v.set(Some(&c3));
+    //~^ ERROR `c3` does not live long enough
     c3.v[0].v.set(Some(&c1));
+    //~^ ERROR `c1` does not live long enough
     c3.v[1].v.set(Some(&c2));
+    //~^ ERROR `c2` does not live long enough
 }
-//~^ ERROR `c2` does not live long enough
-//~| ERROR `c3` does not live long enough
-//~| ERROR `c2` does not live long enough
-//~| ERROR `c3` does not live long enough
-//~| ERROR `c1` does not live long enough
-//~| ERROR `c2` does not live long enough
 
 fn main() {
     f();
index d7d0fe5323ba2735218fcb9b7ba6366ffe433027..799dfb8e2010b2579f02570f0517eb89528cdbfd 100644 (file)
@@ -1,65 +1,66 @@
 error[E0597]: `c2` does not live long enough
-   --> $DIR/dropck_vec_cycle_checked.rs:116:1
+   --> $DIR/dropck_vec_cycle_checked.rs:110:25
     |
 110 |     c1.v[0].v.set(Some(&c2));
-    |                         -- borrow occurs here
+    |                         ^^ borrowed value does not live long enough
 ...
-116 | }
-    | ^ `c2` dropped here while still borrowed
+122 | }
+    | - `c2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c3` does not live long enough
-   --> $DIR/dropck_vec_cycle_checked.rs:116:1
+   --> $DIR/dropck_vec_cycle_checked.rs:112:25
     |
-111 |     c1.v[1].v.set(Some(&c3));
-    |                         -- borrow occurs here
+112 |     c1.v[1].v.set(Some(&c3));
+    |                         ^^ borrowed value does not live long enough
 ...
-116 | }
-    | ^ `c3` dropped here while still borrowed
+122 | }
+    | - `c3` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c2` does not live long enough
-   --> $DIR/dropck_vec_cycle_checked.rs:116:1
+   --> $DIR/dropck_vec_cycle_checked.rs:114:25
     |
-112 |     c2.v[0].v.set(Some(&c2));
-    |                         -- borrow occurs here
+114 |     c2.v[0].v.set(Some(&c2));
+    |                         ^^ borrowed value does not live long enough
 ...
-116 | }
-    | ^ `c2` dropped here while still borrowed
+122 | }
+    | - `c2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c3` does not live long enough
-   --> $DIR/dropck_vec_cycle_checked.rs:116:1
+   --> $DIR/dropck_vec_cycle_checked.rs:116:25
     |
-113 |     c2.v[1].v.set(Some(&c3));
-    |                         -- borrow occurs here
+116 |     c2.v[1].v.set(Some(&c3));
+    |                         ^^ borrowed value does not live long enough
 ...
-116 | }
-    | ^ `c3` dropped here while still borrowed
+122 | }
+    | - `c3` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c1` does not live long enough
-   --> $DIR/dropck_vec_cycle_checked.rs:116:1
+   --> $DIR/dropck_vec_cycle_checked.rs:118:25
     |
-114 |     c3.v[0].v.set(Some(&c1));
-    |                         -- borrow occurs here
-115 |     c3.v[1].v.set(Some(&c2));
-116 | }
-    | ^ `c1` dropped here while still borrowed
+118 |     c3.v[0].v.set(Some(&c1));
+    |                         ^^ borrowed value does not live long enough
+...
+122 | }
+    | - `c1` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c2` does not live long enough
-   --> $DIR/dropck_vec_cycle_checked.rs:116:1
+   --> $DIR/dropck_vec_cycle_checked.rs:120:25
     |
-115 |     c3.v[1].v.set(Some(&c2));
-    |                         -- borrow occurs here
-116 | }
-    | ^ `c2` dropped here while still borrowed
+120 |     c3.v[1].v.set(Some(&c2));
+    |                         ^^ borrowed value does not live long enough
+121 |     //~^ ERROR `c2` does not live long enough
+122 | }
+    | - `c2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
index 057ccc8d677e91c448c92557dab54a426cbe02fe..01cd7661fb73d7da93af1f19cd4cd8d8c0ee397e 100644 (file)
@@ -4,7 +4,7 @@ error[E0597]: `x` does not live long enough
 18 |         let f = to_fn_once(move|| &x); //~ ERROR does not live long enough
    |                                    ^
    |                                    |
-   |                                    borrow occurs here
+   |                                    borrowed value does not live long enough
    |                                    `x` dropped here while still borrowed
 ...
 23 | }
index 90f3e1fd00a0832f168117beb6c32cba3e8ec652..2fbc63eb80537f14e43a8aa3aefc49cff5d632f5 100644 (file)
@@ -13,7 +13,8 @@ fn id<T>(x: T) -> T { x }
 fn main() {
     let v = vec![
         &id(3)
-    ]; //~ ERROR borrowed value does not live long enough
+    ];
+    //~^^ ERROR borrowed value does not live long enough
 
     for &&x in &v {
         println!("{}", x + 3);
index 4d2e6f8374c1f8982cd07ace18674575a6a95250..28841fbea973c55121095eb18be121e0d24f477a 100644 (file)
@@ -1,12 +1,12 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/issue-15480.rs:16:6
+  --> $DIR/issue-15480.rs:15:10
    |
 15 |         &id(3)
-   |          ----- temporary value created here
-16 |     ]; //~ ERROR borrowed value does not live long enough
-   |      ^ temporary value dropped here while still borrowed
+   |          ^^^^^ temporary value does not live long enough
+16 |     ];
+   |      - temporary value dropped here while still borrowed
 ...
-21 | }
+22 | }
    | - temporary value needs to live until here
    |
    = note: consider using a `let` binding to increase its lifetime
index 583c569062170d07d17a2919a6dc679bd6d61791..8f556d288198a155c802ae0d352f5518758d987f 100644 (file)
@@ -19,13 +19,14 @@ fn foo(x: RefCell<String>) -> String {
     let y = x;
     y.borrow().clone()
 }
-//~^ ERROR `y` does not live long enough
+//~^^ ERROR `y` does not live long enough
 
 fn foo2(x: RefCell<String>) -> String {
     let ret = {
         let y = x;
         y.borrow().clone()
-    }; //~ ERROR `y` does not live long enough
+    };
+    //~^^ ERROR `y` does not live long enough
     ret
 }
 
index 090cf1d924bdbb00622407d6c30f6560e3423b06..1c9a64bc21309ec1a77f69d3eb8c1bb640bae513 100644 (file)
@@ -1,20 +1,20 @@
 error[E0597]: `y` does not live long enough
-  --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:21:1
+  --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5
    |
 20 |     y.borrow().clone()
-   |     - borrow occurs here
+   |     ^ borrowed value does not live long enough
 21 | }
-   | ^ `y` dropped here while still borrowed
+   | - `y` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:28:5
+  --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9
    |
 27 |         y.borrow().clone()
-   |         - borrow occurs here
-28 |     }; //~ ERROR `y` does not live long enough
-   |     ^- borrowed value needs to live until here
+   |         ^ borrowed value does not live long enough
+28 |     };
+   |     -- borrowed value needs to live until here
    |     |
    |     `y` dropped here while still borrowed
 
index acd363fc6b05237417a39722481f332d1870bb19..7b3c09659e1512c721191c4edd23cd2397f1a233 100644 (file)
@@ -36,11 +36,11 @@ fn f_child() {
     d1 = D_Child(1);
     // ... we store a reference to `d1` within `_d` ...
     _d = D_Child(&d1);
+    //~^ ERROR `d1` does not live long enough
 
     // ... dropck *should* complain, because Drop of _d could (and
     // does) access the already dropped `d1` via the `foo` method.
 }
-//~^ ERROR `d1` does not live long enough
 
 fn main() {
     f_child();
index 29587b7fbde9e6637ab42c0fec1c77b880be2b7f..f61a091950173411eb3ccf86b736a65046f3b51e 100644 (file)
@@ -1,11 +1,11 @@
 error[E0597]: `d1` does not live long enough
-  --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:42:1
+  --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:38:19
    |
 38 |     _d = D_Child(&d1);
-   |                   -- borrow occurs here
+   |                   ^^ borrowed value does not live long enough
 ...
-42 | }
-   | ^ `d1` dropped here while still borrowed
+43 | }
+   | - `d1` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 3deb71411e84f810b79db69150bc75d4ce05173a..75523386931c091f79609917a38973b2ab23f1d9 100644 (file)
@@ -46,19 +46,19 @@ fn f_sm() {
     d1 = D_HasSelfMethod(1);
     _d = D_HasSelfMethod(&d1);
 }
-//~^ ERROR `d1` does not live long enough
+//~^^ ERROR `d1` does not live long enough
 fn f_mwsa() {
     let (_d, d1);
     d1 = D_HasMethodWithSelfArg(1);
     _d = D_HasMethodWithSelfArg(&d1);
 }
-//~^ ERROR `d1` does not live long enough
+//~^^ ERROR `d1` does not live long enough
 fn f_t() {
     let (_d, d1);
     d1 = D_HasType(1);
     _d = D_HasType(&d1);
 }
-//~^ ERROR `d1` does not live long enough
+//~^^ ERROR `d1` does not live long enough
 
 fn main() {
     f_sm();
index c88d4a0202fba67f074cf37af4374ac661d05f19..662ec58805d90f6d854150d449c3fa67892b44a5 100644 (file)
@@ -1,30 +1,30 @@
 error[E0597]: `d1` does not live long enough
-  --> $DIR/issue-24805-dropck-trait-has-items.rs:48:1
+  --> $DIR/issue-24805-dropck-trait-has-items.rs:47:27
    |
 47 |     _d = D_HasSelfMethod(&d1);
-   |                           -- borrow occurs here
+   |                           ^^ borrowed value does not live long enough
 48 | }
-   | ^ `d1` dropped here while still borrowed
+   | - `d1` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `d1` does not live long enough
-  --> $DIR/issue-24805-dropck-trait-has-items.rs:54:1
+  --> $DIR/issue-24805-dropck-trait-has-items.rs:53:34
    |
 53 |     _d = D_HasMethodWithSelfArg(&d1);
-   |                                  -- borrow occurs here
+   |                                  ^^ borrowed value does not live long enough
 54 | }
-   | ^ `d1` dropped here while still borrowed
+   | - `d1` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `d1` does not live long enough
-  --> $DIR/issue-24805-dropck-trait-has-items.rs:60:1
+  --> $DIR/issue-24805-dropck-trait-has-items.rs:59:21
    |
 59 |     _d = D_HasType(&d1);
-   |                     -- borrow occurs here
+   |                     ^^ borrowed value does not live long enough
 60 | }
-   | ^ `d1` dropped here while still borrowed
+   | - `d1` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index a4207eb0aa949f433eb1f5b8a7235f2d38c875ba..326e6b43e25b45b07a7a7d76f448d70bf0ac8c48 100644 (file)
@@ -35,4 +35,5 @@ fn main() {
     let (d2, d1);
     d1 = D(34, "d1");
     d2 = D(S(&d1, "inner"), "d2");
-} //~ ERROR `d1` does not live long enough
+}
+//~^^ ERROR `d1` does not live long enough
index 7f80e6e115af4c3230b30245520c69b9fa89d83f..1c68cacad7c99c48416022c55fad5593d7693572 100644 (file)
@@ -1,10 +1,10 @@
 error[E0597]: `d1` does not live long enough
-  --> $DIR/issue-24895-copy-clone-dropck.rs:38:1
+  --> $DIR/issue-24895-copy-clone-dropck.rs:37:15
    |
 37 |     d2 = D(S(&d1, "inner"), "d2");
-   |               -- borrow occurs here
-38 | } //~ ERROR `d1` does not live long enough
-   | ^ `d1` dropped here while still borrowed
+   |               ^^ borrowed value does not live long enough
+38 | }
+   | - `d1` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index b88c58c29ac3d90fd6dc1af227c274ca28ccdc50..7b1f4005e63336459195a0298b93881f9b1ac8d6 100644 (file)
@@ -78,8 +78,8 @@ fn drop(&mut self) {
 fn main() {
     let container = Container::new();
     let test = Test{test: &container};
+    //~^ ERROR `container` does not live long enough
     println!("container.v[30]: {:?}", container.v.v[30]);
     container.store(test);
+    //~^ ERROR `container` does not live long enough
 }
-//~^ ERROR `container` does not live long enough
-//~| ERROR `container` does not live long enough
index 4f403b38f5a1f1bc737012c1f950770ac17854d4..af02e9d6d54f16910278dcd43baf8b37e0a63072 100644 (file)
@@ -1,21 +1,22 @@
 error[E0597]: `container` does not live long enough
-  --> $DIR/issue-25199.rs:83:1
+  --> $DIR/issue-25199.rs:80:28
    |
 80 |     let test = Test{test: &container};
-   |                            --------- borrow occurs here
+   |                            ^^^^^^^^^ borrowed value does not live long enough
 ...
-83 | }
-   | ^ `container` dropped here while still borrowed
+85 | }
+   | - `container` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `container` does not live long enough
-  --> $DIR/issue-25199.rs:83:1
+  --> $DIR/issue-25199.rs:83:5
    |
-82 |     container.store(test);
-   |     --------- borrow occurs here
-83 | }
-   | ^ `container` dropped here while still borrowed
+83 |     container.store(test);
+   |     ^^^^^^^^^ borrowed value does not live long enough
+84 |     //~^ ERROR `container` does not live long enough
+85 | }
+   | - `container` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 621da477ddcbf78a52757fb50d02300190db90bf..05f0ea5474f1ebd4d3acfef7fcc2d0daaf0656e1 100644 (file)
@@ -49,4 +49,4 @@ fn main() {
     ticking = Bomb { usable: true };
     zook.button = B::BigRedButton(&ticking);
 }
-//~^ ERROR `ticking` does not live long enough
+//~^^ ERROR `ticking` does not live long enough
index 748fcae48fcba03958782e66398d5a18f37fd10b..1d632271f81448405c037e2f71c62c79255518d1 100644 (file)
@@ -1,10 +1,10 @@
 error[E0597]: `ticking` does not live long enough
-  --> $DIR/issue-26656.rs:51:1
+  --> $DIR/issue-26656.rs:50:36
    |
 50 |     zook.button = B::BigRedButton(&ticking);
-   |                                    ------- borrow occurs here
+   |                                    ^^^^^^^ borrowed value does not live long enough
 51 | }
-   | ^ `ticking` dropped here while still borrowed
+   | - `ticking` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 8d28c64f264c90cfc38e99f32a5a5716c7429af7..03a9a629c91358c99a89ed0e4f9fb6ae5e59c087 100644 (file)
@@ -24,11 +24,13 @@ fn main() {
         let (y, x);
         x = "alive".to_string();
         y = Arc::new(Foo(&x));
-    } //~ ERROR `x` does not live long enough
+    }
+    //~^^ ERROR `x` does not live long enough
 
     {
         let (y, x);
         x = "alive".to_string();
         y = Rc::new(Foo(&x));
-    } //~ ERROR `x` does not live long enough
+    }
+    //~^^ ERROR `x` does not live long enough
 }
index f146028c2fcf190988f016ba0ac119688076e315..24042e23fef0180737e82634cd8df93b8affd5fd 100644 (file)
@@ -1,20 +1,20 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/issue-29106.rs:27:5
+  --> $DIR/issue-29106.rs:26:27
    |
 26 |         y = Arc::new(Foo(&x));
-   |                           - borrow occurs here
-27 |     } //~ ERROR `x` does not live long enough
-   |     ^ `x` dropped here while still borrowed
+   |                           ^ borrowed value does not live long enough
+27 |     }
+   |     - `x` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/issue-29106.rs:33:5
+  --> $DIR/issue-29106.rs:33:26
    |
-32 |         y = Rc::new(Foo(&x));
-   |                          - borrow occurs here
-33 |     } //~ ERROR `x` does not live long enough
-   |     ^ `x` dropped here while still borrowed
+33 |         y = Rc::new(Foo(&x));
+   |                          ^ borrowed value does not live long enough
+34 |     }
+   |     - `x` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index be7967ff619ee7a328630332d37967b7bb76b2d2..cf33ccf8095b57ea8f040ce3281114e1a136ec89 100644 (file)
@@ -1,11 +1,11 @@
 error[E0597]: `foo` does not live long enough
-  --> $DIR/issue-40157.rs:12:64
+  --> $DIR/issue-40157.rs:12:53
    |
 12 |     {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });}
-   |      ----------------------------------------------------------^-------------
+   |      -----------------------------------------------^^^----------------------
    |      |                                              |          |
    |      |                                              |          `foo` dropped here while still borrowed
-   |      |                                              borrow occurs here
+   |      |                                              borrowed value does not live long enough
    |      borrowed value needs to live until here
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
index bed768005bf6991f85980115fad1f9e2cd6298d4..cee7c57c2019fea29004764a1dab7b5be30eb87b 100644 (file)
@@ -42,7 +42,7 @@ fn main() {
     foo.data.push(Concrete(0, Cell::new(None)));
 
     foo.data[0].1.set(Some(&foo.data[1]));
+    //~^ ERROR `foo.data` does not live long enough
     foo.data[1].1.set(Some(&foo.data[0]));
+    //~^ ERROR `foo.data` does not live long enough
 }
-//~^ ERROR `foo.data` does not live long enough
-//~| ERROR `foo.data` does not live long enough
index 6beb3109c75d486cf7648b038ddf5ac6b6eb4bb1..8ade2f38eee3e81eea83e5d26f0408cd437a8b0e 100644 (file)
@@ -1,21 +1,22 @@
 error[E0597]: `foo.data` does not live long enough
-  --> $DIR/issue28498-reject-ex1.rs:46:1
+  --> $DIR/issue28498-reject-ex1.rs:44:29
    |
 44 |     foo.data[0].1.set(Some(&foo.data[1]));
-   |                             -------- borrow occurs here
-45 |     foo.data[1].1.set(Some(&foo.data[0]));
-46 | }
-   | ^ `foo.data` dropped here while still borrowed
+   |                             ^^^^^^^^ borrowed value does not live long enough
+...
+48 | }
+   | - `foo.data` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `foo.data` does not live long enough
-  --> $DIR/issue28498-reject-ex1.rs:46:1
+  --> $DIR/issue28498-reject-ex1.rs:46:29
    |
-45 |     foo.data[1].1.set(Some(&foo.data[0]));
-   |                             -------- borrow occurs here
-46 | }
-   | ^ `foo.data` dropped here while still borrowed
+46 |     foo.data[1].1.set(Some(&foo.data[0]));
+   |                             ^^^^^^^^ borrowed value does not live long enough
+47 |     //~^ ERROR `foo.data` does not live long enough
+48 | }
+   | - `foo.data` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 7e7893ac3c8641d98a5293c40c7c06103d891388..92028c7a818c206742cac8837509603e2df5f220 100644 (file)
@@ -40,9 +40,9 @@ fn main() {
     last_dropped = ScribbleOnDrop(format!("last"));
     first_dropped = ScribbleOnDrop(format!("first"));
     foo0 = Foo(0, &last_dropped);
+    //~^ ERROR `last_dropped` does not live long enough
     foo1 = Foo(1, &first_dropped);
+    //~^ ERROR `first_dropped` does not live long enough
 
     println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1);
 }
-//~^ ERROR `last_dropped` does not live long enough
-//~| ERROR `first_dropped` does not live long enough
index 358fa9b7c450d9609fd8d2ed4d6826fed05c9cb1..eb287265dac2e7d07f4e3ad10a85610e48761231 100644 (file)
@@ -1,22 +1,22 @@
 error[E0597]: `last_dropped` does not live long enough
-  --> $DIR/issue28498-reject-lifetime-param.rs:46:1
+  --> $DIR/issue28498-reject-lifetime-param.rs:42:20
    |
 42 |     foo0 = Foo(0, &last_dropped);
-   |                    ------------ borrow occurs here
+   |                    ^^^^^^^^^^^^ borrowed value does not live long enough
 ...
-46 | }
-   | ^ `last_dropped` dropped here while still borrowed
+48 | }
+   | - `last_dropped` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `first_dropped` does not live long enough
-  --> $DIR/issue28498-reject-lifetime-param.rs:46:1
+  --> $DIR/issue28498-reject-lifetime-param.rs:44:20
    |
-43 |     foo1 = Foo(1, &first_dropped);
-   |                    ------------- borrow occurs here
+44 |     foo1 = Foo(1, &first_dropped);
+   |                    ^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
-46 | }
-   | ^ `first_dropped` dropped here while still borrowed
+48 | }
+   | - `first_dropped` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 54fc20b62f25af435f401971ee96ff0560f65d82..27378b1e0bec04da1b783a44be7adebd5b8692ea 100644 (file)
@@ -42,9 +42,9 @@ fn main() {
     last_dropped = ScribbleOnDrop(format!("last"));
     first_dropped = ScribbleOnDrop(format!("first"));
     foo0 = Foo(0, &last_dropped, Box::new(callback));
+    //~^ ERROR `last_dropped` does not live long enough
     foo1 = Foo(1, &first_dropped, Box::new(callback));
+    //~^ ERROR `first_dropped` does not live long enough
 
     println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1);
 }
-//~^ ERROR `last_dropped` does not live long enough
-//~| ERROR `first_dropped` does not live long enough
index 0aaf2b27f60a8d4e30b482479997a54ba957474d..53e0e02319f6f1542fb0334fcaf909b23a6dfbfd 100644 (file)
@@ -1,22 +1,22 @@
 error[E0597]: `last_dropped` does not live long enough
-  --> $DIR/issue28498-reject-passed-to-fn.rs:48:1
+  --> $DIR/issue28498-reject-passed-to-fn.rs:44:20
    |
 44 |     foo0 = Foo(0, &last_dropped, Box::new(callback));
-   |                    ------------ borrow occurs here
+   |                    ^^^^^^^^^^^^ borrowed value does not live long enough
 ...
-48 | }
-   | ^ `last_dropped` dropped here while still borrowed
+50 | }
+   | - `last_dropped` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `first_dropped` does not live long enough
-  --> $DIR/issue28498-reject-passed-to-fn.rs:48:1
+  --> $DIR/issue28498-reject-passed-to-fn.rs:46:20
    |
-45 |     foo1 = Foo(1, &first_dropped, Box::new(callback));
-   |                    ------------- borrow occurs here
+46 |     foo1 = Foo(1, &first_dropped, Box::new(callback));
+   |                    ^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
-48 | }
-   | ^ `first_dropped` dropped here while still borrowed
+50 | }
+   | - `first_dropped` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 6164beaf858dd50d40b882d9c0b7d029b833531f..3904d68ba19dbd18d4e180c06bacf883bbce608f 100644 (file)
@@ -42,9 +42,9 @@ fn main() {
     last_dropped = ScribbleOnDrop(format!("last"));
     first_dropped = ScribbleOnDrop(format!("first"));
     foo0 = Foo(0, &last_dropped);
+    //~^ ERROR `last_dropped` does not live long enough
     foo1 = Foo(1, &first_dropped);
+    //~^ ERROR `first_dropped` does not live long enough
 
     println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1);
 }
-//~^ ERROR `last_dropped` does not live long enough
-//~| ERROR `first_dropped` does not live long enough
index 27a4d2384ab79d672b7aa535824319f805cacad6..6b53745bbc86b8288ed922f18d54a1acb783af2f 100644 (file)
@@ -1,22 +1,22 @@
 error[E0597]: `last_dropped` does not live long enough
-  --> $DIR/issue28498-reject-trait-bound.rs:48:1
+  --> $DIR/issue28498-reject-trait-bound.rs:44:20
    |
 44 |     foo0 = Foo(0, &last_dropped);
-   |                    ------------ borrow occurs here
+   |                    ^^^^^^^^^^^^ borrowed value does not live long enough
 ...
-48 | }
-   | ^ `last_dropped` dropped here while still borrowed
+50 | }
+   | - `last_dropped` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `first_dropped` does not live long enough
-  --> $DIR/issue28498-reject-trait-bound.rs:48:1
+  --> $DIR/issue28498-reject-trait-bound.rs:46:20
    |
-45 |     foo1 = Foo(1, &first_dropped);
-   |                    ------------- borrow occurs here
+46 |     foo1 = Foo(1, &first_dropped);
+   |                    ^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
-48 | }
-   | ^ `first_dropped` dropped here while still borrowed
+50 | }
+   | - `first_dropped` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index 135b577d7f785dd1b8d00e0059bea07265f95c8f..9dc0836c5e0628ed572764cb56a3145dda20356c 100644 (file)
@@ -16,5 +16,6 @@ fn main() {
     {
         let b = m.borrow();
         p = &*b;
-    } //~ ERROR `b` does not live long enough
+    }
+    //~^^ ERROR `b` does not live long enough
 }
index d9f5736061a357fb26e08cd3d2fd10fc31f55b13..e39af8501742d90d1829a7942e5135d74301af27 100644 (file)
@@ -1,11 +1,12 @@
 error[E0597]: `b` does not live long enough
-  --> $DIR/mut-ptr-cant-outlive-ref.rs:19:5
+  --> $DIR/mut-ptr-cant-outlive-ref.rs:18:15
    |
 18 |         p = &*b;
-   |               - borrow occurs here
-19 |     } //~ ERROR `b` does not live long enough
-   |     ^ `b` dropped here while still borrowed
-20 | }
+   |               ^ borrowed value does not live long enough
+19 |     }
+   |     - `b` dropped here while still borrowed
+20 |     //~^^ ERROR `b` does not live long enough
+21 | }
    | - borrowed value needs to live until here
 
 error: aborting due to previous error
index 589f7182129d8fc2cbbfc3a12ac0478899d051d9..d69b3ea098cb3b9d954f5a9e074f609eba502b60 100644 (file)
@@ -16,6 +16,6 @@ pub fn main() {
         let b = 42;
         &a..&b
     };
-    //~^ ERROR `a` does not live long enough
-    //~^^ ERROR `b` does not live long enough
+    //~^^ ERROR `a` does not live long enough
+    //~| ERROR `b` does not live long enough
 }
index 80d364cd8be4b5763bd2af57eaa8b86321b7a915..106a8a7667fb420aecd74d1522c42046df7ae264 100644 (file)
@@ -1,21 +1,21 @@
 error[E0597]: `a` does not live long enough
-  --> $DIR/range-2.rs:18:5
+  --> $DIR/range-2.rs:17:10
    |
 17 |         &a..&b
-   |          - borrow occurs here
+   |          ^ borrowed value does not live long enough
 18 |     };
-   |     ^ `a` dropped here while still borrowed
+   |     - `a` dropped here while still borrowed
 ...
 21 | }
    | - borrowed value needs to live until here
 
 error[E0597]: `b` does not live long enough
-  --> $DIR/range-2.rs:18:5
+  --> $DIR/range-2.rs:17:14
    |
 17 |         &a..&b
-   |              - borrow occurs here
+   |              ^ borrowed value does not live long enough
 18 |     };
-   |     ^ `b` dropped here while still borrowed
+   |     - `b` dropped here while still borrowed
 ...
 21 | }
    | - borrowed value needs to live until here
index 74a6a2960c947a42be0c104fd8aee3b9593e6482..93b3d6733598e1c9edc8774d6c475419226aa38f 100644 (file)
@@ -15,6 +15,7 @@ fn main() {
     {
         let c = 1;
         let c_ref = &c;
+        //~^ ERROR `c` does not live long enough
         f = move |a: isize, b: isize| { a + b + *c_ref };
-    } //~ ERROR `c` does not live long enough
+    }
 }
index acd995c6bb86fefcead2599d9290d2abc91068a8..ca453c22cce4fb989271fc5411ca258d0f40f601 100644 (file)
@@ -1,12 +1,12 @@
 error[E0597]: `c` does not live long enough
-  --> $DIR/regionck-unboxed-closure-lifetimes.rs:19:5
+  --> $DIR/regionck-unboxed-closure-lifetimes.rs:17:22
    |
 17 |         let c_ref = &c;
-   |                      - borrow occurs here
-18 |         f = move |a: isize, b: isize| { a + b + *c_ref };
-19 |     } //~ ERROR `c` does not live long enough
-   |     ^ `c` dropped here while still borrowed
-20 | }
+   |                      ^ borrowed value does not live long enough
+...
+20 |     }
+   |     - `c` dropped here while still borrowed
+21 | }
    | - borrowed value needs to live until here
 
 error: aborting due to previous error
index 5449bbfdce3a3bec89c6f720fb1074119d9ed99e..cf94969742efeaf222e8eb5fcf7596efa0e5e5cb 100644 (file)
@@ -20,6 +20,7 @@ fn main() {
     let blah;
     {
         let ss: &isize = &id(1);
+        //~^ ERROR borrowed value does not live long enough
         blah = box ss as Box<Foo>;
-    } //~ ERROR does not live long enough
+    }
 }
index 69bdde889166fc4769b3b01869023df0ad5472c8..12f70676220b70ebeb95b8ee3f934a90c3edc4df 100644 (file)
@@ -1,12 +1,12 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:24:5
+  --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:27
    |
 22 |         let ss: &isize = &id(1);
-   |                           ----- temporary value created here
-23 |         blah = box ss as Box<Foo>;
-24 |     } //~ ERROR does not live long enough
-   |     ^ temporary value dropped here while still borrowed
-25 | }
+   |                           ^^^^^ temporary value does not live long enough
+...
+25 |     }
+   |     - temporary value dropped here while still borrowed
+26 | }
    | - temporary value needs to live until here
 
 error: aborting due to previous error
index cd838db92e1888e1134ea52dc8ed940a5986cab2..e7eff6f25591aac8763d58470f474368d5739879 100644 (file)
@@ -32,5 +32,6 @@ fn main() {
         let tmp0 = 3;
         let tmp1 = &tmp0;
         repeater3(tmp1)
-    }; //~ ERROR `tmp0` does not live long enough
+    };
+    //~^^^ ERROR `tmp0` does not live long enough
 }
index a7f79f8b26528ce45c5733f84a2cff909a851a61..b90e67d5a3cee5ec2004f0cd6b7e8e0ed561ade9 100644 (file)
@@ -1,11 +1,11 @@
 error[E0597]: `tmp0` does not live long enough
-  --> $DIR/regions-close-over-type-parameter-2.rs:35:5
+  --> $DIR/regions-close-over-type-parameter-2.rs:33:21
    |
 33 |         let tmp1 = &tmp0;
-   |                     ---- borrow occurs here
+   |                     ^^^^ borrowed value does not live long enough
 34 |         repeater3(tmp1)
-35 |     }; //~ ERROR `tmp0` does not live long enough
-   |     ^- borrowed value needs to live until here
+35 |     };
+   |     -- borrowed value needs to live until here
    |     |
    |     `tmp0` dropped here while still borrowed
 
index 1dc1ae6071578f5159463f8f6ab6d5725207b4b5..96c1ccd5326ea8e141d93e2ee3a8f767e93de3cb 100644 (file)
@@ -19,5 +19,6 @@ fn main() {
     loop {
         let x = 1 + *p;
         p = &x;
-    } //~ ERROR `x` does not live long enough
+    }
+    //~^^ ERROR `x` does not live long enough
 }
index 554ffe91e6d1ff8db7852a533f5170daa54ba8c4..8cdf4e2d8226f49eb34a184f4cce3c0f18f4fc77 100644 (file)
@@ -1,11 +1,12 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/regions-escape-loop-via-variable.rs:22:5
+  --> $DIR/regions-escape-loop-via-variable.rs:21:14
    |
 21 |         p = &x;
-   |              - borrow occurs here
-22 |     } //~ ERROR `x` does not live long enough
-   |     ^ `x` dropped here while still borrowed
-23 | }
+   |              ^ borrowed value does not live long enough
+22 |     }
+   |     - `x` dropped here while still borrowed
+23 |     //~^^ ERROR `x` does not live long enough
+24 | }
    | - borrowed value needs to live until here
 
 error: aborting due to previous error
index 3bb069813a29f579605654fef94af8f100a86ece..b6adc2206e9ce9697c0c07833f40a1d15d7bc764 100644 (file)
@@ -22,10 +22,11 @@ fn foo<C, M>(mut cond: C, mut make_box: M) where
         // Here we complain because the resulting region
         // of this borrow is the fn body as a whole.
         y = borrow(&*x);
+        //~^ ERROR `*x` does not live long enough
 
         assert_eq!(*x, *y);
         if cond() { break; }
-    } //~ ERROR `*x` does not live long enough
+    }
     assert!(*y != 0);
 }
 
index 4a44a3a68137998bf711ba921eb9d5498b5bf8e1..1fc7e05f496ba7f80eb15b641207f6a8f6d50b82 100644 (file)
@@ -1,13 +1,13 @@
 error[E0597]: `*x` does not live long enough
-  --> $DIR/regions-infer-borrow-scope-within-loop.rs:28:5
+  --> $DIR/regions-infer-borrow-scope-within-loop.rs:24:21
    |
 24 |         y = borrow(&*x);
-   |                     -- borrow occurs here
+   |                     ^^ borrowed value does not live long enough
 ...
-28 |     } //~ ERROR `*x` does not live long enough
-   |     ^ `*x` dropped here while still borrowed
-29 |     assert!(*y != 0);
-30 | }
+29 |     }
+   |     - `*x` dropped here while still borrowed
+30 |     assert!(*y != 0);
+31 | }
    | - borrowed value needs to live until here
 
 error: aborting due to previous error
index d294840bdfb33f0a3410653ebe1bd3f509bfcace..20f8d473ac369eb10d01961416fcc6f0f750e943 100644 (file)
@@ -24,12 +24,13 @@ fn main() {
     let bad = {
         let x = 1;
         let y = &x;
+        //~^ ERROR `x` does not live long enough
 
         scoped(|| {
             let _z = y;
             //~^ ERROR `y` does not live long enough
         })
-    }; //~ ERROR `x` does not live long enough
+    };
 
     bad.join();
 }
index cc12b2c1ee2b2a8ac9289a26ce07c361af2c7255..657682d962d1508c0d0bca8dda908164271b9e53 100644 (file)
@@ -1,27 +1,27 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/send-is-not-static-ensures-scoping.rs:32:5
+  --> $DIR/send-is-not-static-ensures-scoping.rs:26:18
    |
 26 |         let y = &x;
-   |                  - borrow occurs here
+   |                  ^ borrowed value does not live long enough
 ...
-32 |     }; //~ ERROR `x` does not live long enough
-   |     ^ `x` dropped here while still borrowed
+33 |     };
+   |     - `x` dropped here while still borrowed
 ...
-35 | }
+36 | }
    | - borrowed value needs to live until here
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/send-is-not-static-ensures-scoping.rs:29:22
+  --> $DIR/send-is-not-static-ensures-scoping.rs:30:22
    |
-28 |         scoped(|| {
+29 |         scoped(|| {
    |                -- capture occurs here
-29 |             let _z = y;
-   |                      ^ does not live long enough
+30 |             let _z = y;
+   |                      ^ borrowed value does not live long enough
 ...
-32 |     }; //~ ERROR `x` does not live long enough
+33 |     };
    |     - borrowed value only lives until here
 ...
-35 | }
+36 | }
    | - borrowed value needs to live until here
 
 error: aborting due to 2 previous errors
index 762eeffaa6af4a6c711c3b94e79a621602989990..a10f700fb541b7e19837561e89f72c2f1414ac79 100644 (file)
@@ -19,7 +19,8 @@ fn mutex() {
     let lock = {
         let x = 1;
         Mutex::new(&x)
-    }; //~ ERROR does not live long enough
+    };
+    //~^^ ERROR `x` does not live long enough
 
     let _dangling = *lock.lock().unwrap();
 }
@@ -28,7 +29,8 @@ fn rwlock() {
     let lock = {
         let x = 1;
         RwLock::new(&x)
-    }; //~ ERROR does not live long enough
+    };
+    //~^^ ERROR `x` does not live long enough
     let _dangling = *lock.read().unwrap();
 }
 
@@ -38,7 +40,8 @@ fn channel() {
         let (tx, rx) = mpsc::channel();
         let _ = tx.send(&x);
         (tx, rx)
-    }; //~ ERROR does not live long enough
+    };
+    //~^^^ ERROR `x` does not live long enough
 
     let _dangling = rx.recv();
 }
index beee85c8b1d9ad602ea8a4f168f7fd26b3de3523..af8b7aeaa6357ccb9c5c6f4bca2ff5a667bee0fc 100644 (file)
@@ -1,35 +1,35 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/send-is-not-static-std-sync-2.rs:22:5
+  --> $DIR/send-is-not-static-std-sync-2.rs:21:21
    |
 21 |         Mutex::new(&x)
-   |                     - borrow occurs here
-22 |     }; //~ ERROR does not live long enough
-   |     ^ `x` dropped here while still borrowed
+   |                     ^ borrowed value does not live long enough
+22 |     };
+   |     - `x` dropped here while still borrowed
 ...
-25 | }
+26 | }
    | - borrowed value needs to live until here
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/send-is-not-static-std-sync-2.rs:31:5
+  --> $DIR/send-is-not-static-std-sync-2.rs:31:22
    |
-30 |         RwLock::new(&x)
-   |                      - borrow occurs here
-31 |     }; //~ ERROR does not live long enough
-   |     ^ `x` dropped here while still borrowed
-32 |     let _dangling = *lock.read().unwrap();
-33 | }
+31 |         RwLock::new(&x)
+   |                      ^ borrowed value does not live long enough
+32 |     };
+   |     - `x` dropped here while still borrowed
+...
+35 | }
    | - borrowed value needs to live until here
 
 error[E0597]: `x` does not live long enough
-  --> $DIR/send-is-not-static-std-sync-2.rs:41:5
+  --> $DIR/send-is-not-static-std-sync-2.rs:41:26
    |
-39 |         let _ = tx.send(&x);
-   |                          - borrow occurs here
-40 |         (tx, rx)
-41 |     }; //~ ERROR does not live long enough
-   |     ^ `x` dropped here while still borrowed
+41 |         let _ = tx.send(&x);
+   |                          ^ borrowed value does not live long enough
+42 |         (tx, rx)
+43 |     };
+   |     - `x` dropped here while still borrowed
 ...
-44 | }
+47 | }
    | - borrowed value needs to live until here
 
 error: aborting due to 3 previous errors
index 05cb962755801f1dd3ed82d742c05ec08747015f..4cf36e00a6fe88d63a28d9c0a8543140ae0fcdb5 100644 (file)
@@ -24,7 +24,8 @@ fn mutex() {
     {
         let z = 2;
         *lock.lock().unwrap() = &z;
-    } //~ ERROR does not live long enough
+    }
+    //~^^ ERROR `z` does not live long enough
 }
 
 fn rwlock() {
@@ -36,7 +37,8 @@ fn rwlock() {
     {
         let z = 2;
         *lock.write().unwrap() = &z;
-    } //~ ERROR does not live long enough
+    }
+    //~^^ ERROR `z` does not live long enough
 }
 
 fn channel() {
@@ -50,7 +52,8 @@ fn channel() {
     {
         let z = 2;
         tx.send(&z).unwrap();
-    } //~ ERROR does not live long enough
+    }
+    //~^^ ERROR `z` does not live long enough
 }
 
 fn main() {}
index e078e4e14a5ca3b5d2b56d81899d1fad4a766f88..7c61398a8640e08c773fc890a171b5b63f5d8976 100644 (file)
@@ -1,11 +1,12 @@
 error[E0597]: `z` does not live long enough
-  --> $DIR/send-is-not-static-std-sync.rs:27:5
+  --> $DIR/send-is-not-static-std-sync.rs:26:34
    |
 26 |         *lock.lock().unwrap() = &z;
-   |                                  - borrow occurs here
-27 |     } //~ ERROR does not live long enough
-   |     ^ `z` dropped here while still borrowed
-28 | }
+   |                                  ^ borrowed value does not live long enough
+27 |     }
+   |     - `z` dropped here while still borrowed
+28 |     //~^^ ERROR `z` does not live long enough
+29 | }
    | - borrowed value needs to live until here
 
 error[E0505]: cannot move out of `y` because it is borrowed
@@ -17,39 +18,41 @@ error[E0505]: cannot move out of `y` because it is borrowed
    |          ^ move out of `y` occurs here
 
 error[E0597]: `z` does not live long enough
-  --> $DIR/send-is-not-static-std-sync.rs:39:5
+  --> $DIR/send-is-not-static-std-sync.rs:39:35
    |
-38 |         *lock.write().unwrap() = &z;
-   |                                   - borrow occurs here
-39 |     } //~ ERROR does not live long enough
-   |     ^ `z` dropped here while still borrowed
-40 | }
+39 |         *lock.write().unwrap() = &z;
+   |                                   ^ borrowed value does not live long enough
+40 |     }
+   |     - `z` dropped here while still borrowed
+41 |     //~^^ ERROR `z` does not live long enough
+42 | }
    | - 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
+  --> $DIR/send-is-not-static-std-sync.rs:36:10
    |
-34 |     *lock.write().unwrap() = &*y;
+35 |     *lock.write().unwrap() = &*y;
    |                               -- borrow of `*y` occurs here
-35 |     drop(y); //~ ERROR cannot move out
+36 |     drop(y); //~ ERROR cannot move out
    |          ^ move out of `y` occurs here
 
 error[E0597]: `z` does not live long enough
-  --> $DIR/send-is-not-static-std-sync.rs:53:5
+  --> $DIR/send-is-not-static-std-sync.rs:54:18
    |
-52 |         tx.send(&z).unwrap();
-   |                  - borrow occurs here
-53 |     } //~ ERROR does not live long enough
-   |     ^ `z` dropped here while still borrowed
-54 | }
+54 |         tx.send(&z).unwrap();
+   |                  ^ borrowed value does not live long enough
+55 |     }
+   |     - `z` dropped here while still borrowed
+56 |     //~^^ ERROR `z` does not live long enough
+57 | }
    | - 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
+  --> $DIR/send-is-not-static-std-sync.rs:51:10
    |
-48 |     tx.send(&*y);
+50 |     tx.send(&*y);
    |              -- borrow of `*y` occurs here
-49 |     drop(y); //~ ERROR cannot move out
+51 |     drop(y); //~ ERROR cannot move out
    |          ^ move out of `y` occurs here
 
 error: aborting due to 6 previous errors
index 6bb98c34b7e6faafcd6d15810b3267c6e287f8f5..1b022f23246628d56f27037501a2c37c6f5c0192 100644 (file)
@@ -15,5 +15,5 @@ fn main() {
     {
         let x: &[isize] = &vec![1, 2, 3, 4, 5];
         y = &x[1..];
-    } //~ ERROR does not live long enough
+    }
 }
index c1b760aed2bda5ba22846a9e2fce5679a8502b32..540aae0983a26f0d3be636df70c023175e3356c6 100644 (file)
@@ -1,11 +1,11 @@
 error[E0597]: borrowed value does not live long enough
-  --> $DIR/slice-borrow.rs:18:5
+  --> $DIR/slice-borrow.rs:16:28
    |
 16 |         let x: &[isize] = &vec![1, 2, 3, 4, 5];
-   |                            ------------------- temporary value created here
+   |                            ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
 17 |         y = &x[1..];
-18 |     } //~ ERROR does not live long enough
-   |     ^ temporary value dropped here while still borrowed
+18 |     }
+   |     - temporary value dropped here while still borrowed
 19 | }
    | - temporary value needs to live until here
    |
index c4596e7c3684d26412c34ab40dc169c66fd31251..3cf07b8b098c4b4bdf4fa45a8ab35e9c01a3f65d 100644 (file)
@@ -125,10 +125,10 @@ fn f() {
     c1.v.push(CheckId(Cell::new(None)));
     c2.v.push(CheckId(Cell::new(None)));
     c1.v[0].v.set(Some(&c2));
+    //~^ ERROR `c2` does not live long enough
     c2.v[0].v.set(Some(&c1));
+    //~^ ERROR `c1` does not live long enough
 }
-//~^ ERROR `c2` does not live long enough
-//~| ERROR `c1` does not live long enough
 
 fn main() {
     f();
index f7c94ed9f73d138438f064a6db1ffefbe38c327b..cc8e58179ed4f26143861c159589de37d38e029d 100644 (file)
@@ -1,21 +1,22 @@
 error[E0597]: `c2` does not live long enough
-   --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:1
+   --> $DIR/vec-must-not-hide-type-from-dropck.rs:127:25
     |
 127 |     c1.v[0].v.set(Some(&c2));
-    |                         -- borrow occurs here
-128 |     c2.v[0].v.set(Some(&c1));
-129 | }
-    | ^ `c2` dropped here while still borrowed
+    |                         ^^ borrowed value does not live long enough
+...
+131 | }
+    | - `c2` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `c1` does not live long enough
-   --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:1
+   --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:25
     |
-128 |     c2.v[0].v.set(Some(&c1));
-    |                         -- borrow occurs here
-129 | }
-    | ^ `c1` dropped here while still borrowed
+129 |     c2.v[0].v.set(Some(&c1));
+    |                         ^^ borrowed value does not live long enough
+130 |     //~^ ERROR `c1` does not live long enough
+131 | }
+    | - `c1` dropped here while still borrowed
     |
     = note: values in a scope are dropped in the opposite order they are created
 
index f40a25920bf3a9ec658861461106ab71280bc454..42373a87a6c92e3a7ad8d18dc68fe6e9b6f51ac5 100644 (file)
@@ -25,9 +25,9 @@ fn main() {
     let y: i8 = 4;
 
     v.push(&x);
+    //~^ ERROR `x` does not live long enough
     v.push(&y);
+    //~^ ERROR `y` does not live long enough
 
     assert_eq!(v, [&3, &4]);
 }
-//~^ ERROR `x` does not live long enough
-//~| ERROR `y` does not live long enough
index 282e5caf20787ce1bed47cf4425d813575425576..acfc7babe01f79bf6d69ebace7f1437a3a965368 100644 (file)
@@ -1,22 +1,22 @@
 error[E0597]: `x` does not live long enough
-  --> $DIR/vec_refs_data_with_early_death.rs:31:1
+  --> $DIR/vec_refs_data_with_early_death.rs:27:13
    |
 27 |     v.push(&x);
-   |             - borrow occurs here
+   |             ^ borrowed value does not live long enough
 ...
-31 | }
-   | ^ `x` dropped here while still borrowed
+33 | }
+   | - `x` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
 error[E0597]: `y` does not live long enough
-  --> $DIR/vec_refs_data_with_early_death.rs:31:1
+  --> $DIR/vec_refs_data_with_early_death.rs:29:13
    |
-28 |     v.push(&y);
-   |             - borrow occurs here
+29 |     v.push(&y);
+   |             ^ borrowed value does not live long enough
 ...
-31 | }
-   | ^ `y` dropped here while still borrowed
+33 | }
+   | - `y` dropped here while still borrowed
    |
    = note: values in a scope are dropped in the opposite order they are created
 
index ce5ec63fbd10d09c3a8c332c53f98ca5563e15ad..d58c29d4a32d3bdfd307e4379b01302d6b1f7d85 100644 (file)
@@ -28,6 +28,7 @@ fn main() {
     let dangling = {
         let pointer = Box::new(42);
         f2.xmute(&pointer)
-    }; //~ ERROR `pointer` does not live long enough
+    };
+    //~^^ ERROR `pointer` does not live long enough
     println!("{}", dangling);
 }
index a3fdc53b8e54f44d673d33aeb05d8c5dff51a261..8dd772590356c0d9c1d900dcbef907d3a755be17 100644 (file)
@@ -1,12 +1,12 @@
 error[E0597]: `pointer` does not live long enough
-  --> $DIR/wf-method-late-bound-regions.rs:31:5
+  --> $DIR/wf-method-late-bound-regions.rs:30:19
    |
 30 |         f2.xmute(&pointer)
-   |                   ------- borrow occurs here
-31 |     }; //~ ERROR `pointer` does not live long enough
-   |     ^ `pointer` dropped here while still borrowed
-32 |     println!("{}", dangling);
-33 | }
+   |                   ^^^^^^^ borrowed value does not live long enough
+31 |     };
+   |     - `pointer` dropped here while still borrowed
+...
+34 | }
    | - borrowed value needs to live until here
 
 error: aborting due to previous error