]> git.lizzy.rs Git - rust.git/commitdiff
Updates to tests reflecting the diangostic changes in previous commit.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Mon, 17 Sep 2018 23:52:31 +0000 (01:52 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Tue, 18 Sep 2018 00:06:45 +0000 (02:06 +0200)
It is worth pointing out that the reason that so few diagnostics are
effected is because of the filter I put in where it only goes down the
new path if the borrowed place is *not* a prefix of the dropped place.

(Without that filter, a *lot* of the tests would need this change, and
it would probably be a net loss for the UX, since you'd see it even in
cases like borrows of generic types where there is no explicit mention
of `Drop`.)

src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr
src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr
src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr
src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs
src/test/ui/nll/issue-31567.rs
src/test/ui/nll/issue-31567.stderr
src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr
src/test/ui/span/issue28498-reject-ex1.nll.stderr

index 827b66cf068b4cd6c08cc1844175e5c67e521504..5c70294a1b90c0abc22028a7e7937939c078212b 100644 (file)
@@ -1,13 +1,13 @@
-error[E0597]: `local.inner` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/borrowck-fn-in-const-c.rs:27:16
    |
 LL |         return &local.inner; //~ ERROR does not live long enough
-   |                ^^^^^^^^^^^^ borrowed value does not live long enough
+   |                ^^^^^^^^^^^^
 LL |     }
-   |     - `local.inner` dropped here while still borrowed
+   |     - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait
    |
    = note: borrowed value must be valid for the static lifetime...
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
index da0dfac2d18b10eae0c023ebd114fac3e35c854b..70d819f0f467819e26b60039e2280a5aa60302d7 100644 (file)
@@ -1,11 +1,11 @@
-warning[E0597]: `*s.0` does not live long enough
+warning[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
    |
-LL |     &mut *s.0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-   |     ^^^^^^^^^ borrowed value does not live long enough
+LL |     &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+   |     ^^^^^^^^^
 ...
 LL | }
-   | - `*s.0` dropped here while still borrowed
+   | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 62:14...
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:14
@@ -16,14 +16,14 @@ LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0597]: `*s.0` does not live long enough
+warning[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
    |
-LL |     &mut *(*s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-   |     ^^^^^^^^^^^^ borrowed value does not live long enough
+LL |     &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+   |     ^^^^^^^^^^^^
 ...
 LL | }
-   | - `*s.0` dropped here while still borrowed
+   | - here, drop of `*s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 72:20...
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:72:20
@@ -34,14 +34,14 @@ LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
            It represents potential unsoundness in your code.
            This warning will become a hard error in the future.
 
-warning[E0597]: `*s.0` does not live long enough
+warning[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5
    |
-LL |     &mut *(**s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-   |     ^^^^^^^^^^^^^ borrowed value does not live long enough
+LL |     &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+   |     ^^^^^^^^^^^^^
 ...
 LL | }
-   | - `*s.0` dropped here while still borrowed
+   | - here, drop of `**s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 82:26...
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:26
@@ -66,4 +66,4 @@ LL | | }
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
index 09cbc2f9451291ad6eda4cfebdeb782490878421..72ec5affb182b64fb44684d42fec372865f90cfb 100644 (file)
@@ -1,11 +1,11 @@
-error[E0597]: `*s.0` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
    |
-LL |     &mut *s.0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-   |     ^^^^^^^^^ borrowed value does not live long enough
+LL |     &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+   |     ^^^^^^^^^
 ...
 LL | }
-   | - `*s.0` dropped here while still borrowed
+   | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 62:14...
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:14
@@ -13,14 +13,14 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio
 LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
    |              ^^
 
-error[E0597]: `*s.0` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
    |
-LL |     &mut *(*s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-   |     ^^^^^^^^^^^^ borrowed value does not live long enough
+LL |     &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+   |     ^^^^^^^^^^^^
 ...
 LL | }
-   | - `*s.0` dropped here while still borrowed
+   | - here, drop of `*s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 72:20...
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:72:20
@@ -28,14 +28,14 @@ note: borrowed value must be valid for the lifetime 'a as defined on the functio
 LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
    |                    ^^
 
-error[E0597]: `*s.0` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5
    |
-LL |     &mut *(**s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-   |     ^^^^^^^^^^^^^ borrowed value does not live long enough
+LL |     &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+   |     ^^^^^^^^^^^^^
 ...
 LL | }
-   | - `*s.0` dropped here while still borrowed
+   | - here, drop of `**s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 82:26...
   --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:26
@@ -45,4 +45,4 @@ LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
index 5a4874249e2f44a5b5fd8780eb66de0ae4253455..2af05172d24db05cddf4048c3b4374378154e2aa 100644 (file)
@@ -60,8 +60,8 @@ fn boxed_boxed_borrowed_scribble<'a>(s: Box<Box<&'a mut Scribble>>) -> &'a mut u
 // this should be an error. (Which is perhaps the essence of why
 // rust-lang/rust#45696 arose in the first place.)
 fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
-    &mut *s.0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-    //[migrate]~^ WARNING `*s.0` does not live long enough [E0597]
+    &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+    //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
     //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility
 }
 
@@ -70,8 +70,8 @@ fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
 // (But again, AST-borrowck was not smart enogh to know that this
 // should be an error.)
 fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
-    &mut *(*s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-    //[migrate]~^ WARNING `*s.0` does not live long enough [E0597]
+    &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+    //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
     //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility
 }
 
@@ -80,8 +80,8 @@ fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
 // (But again, AST-borrowck was not smart enogh to know that this
 // should be an error.)
 fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
-    &mut *(**s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
-    //[migrate]~^ WARNING `*s.0` does not live long enough [E0597]
+    &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
+    //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
     //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility
 }
 
index a0d1faf1f0e84486d934294e07bc0e41db8afdb8..3508f3033e62efabff66c37b9042230039e4a25e 100644 (file)
@@ -19,7 +19,7 @@
 struct S(Box<u32>);
 
 fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
-    let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
+    let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713]
     &s_inner.0
 }
 
index 532bc493e7dbcc0400d8699dc2793c1f2106a49a..63330f303198156a2348ecf79ecebe12d700c537 100644 (file)
@@ -1,11 +1,11 @@
-error[E0597]: `*v.0` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue-31567.rs:22:26
    |
-LL |     let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
-   |                          ^^^^^ borrowed value does not live long enough
+LL |     let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713]
+   |                          ^^^^^
 LL |     &s_inner.0
 LL | }
-   | - `*v.0` dropped here while still borrowed
+   | - here, drop of `v` needs exclusive access to `*v.0`, because the type `VecWrapper<'_>` implements the `Drop` trait
    |
 note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:17...
   --> $DIR/issue-31567.rs:21:17
@@ -15,4 +15,4 @@ LL | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
index c565842c2c0020e5ad0ecd9b50b09e1289d53000..c94558f12bbde9c04794ecee9fdc117d846b1391 100644 (file)
@@ -1,11 +1,11 @@
-error[E0597]: borrowed value does not live long enough
-  --> $DIR/borrowck-ref-into-rvalue.rs:13:11
+error[E0713]: borrow may still be in use when destructor runs
+  --> $DIR/borrowck-ref-into-rvalue.rs:14:14
    |
-LL |     match Some("Hello".to_string()) {
-   |           ^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+LL |         Some(ref m) => {
+   |              ^^^^^
 ...
 LL |     }
-   |     - temporary value only lives until here
+   |     - drop of temporary value occurs here
 LL |     println!("{}", *msg);
    |                    ---- borrow later used here
    |
@@ -13,4 +13,4 @@ LL |     println!("{}", *msg);
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.
index 27eb4a3afed6d90decde00d95696e01fcf0bac0d..1f72b78ebc76d371b3d89581dfcb2b8c68b53b8f 100644 (file)
@@ -1,17 +1,18 @@
-error[E0597]: `foo.data` does not live long enough
+error[E0713]: borrow may still be in use when destructor runs
   --> $DIR/issue28498-reject-ex1.rs:44:29
    |
 LL |     foo.data[0].1.set(Some(&foo.data[1]));
-   |                             ^^^^^^^^ borrowed value does not live long enough
+   |                             ^^^^^^^^
 ...
 LL | }
    | -
    | |
-   | `foo.data` dropped here while still borrowed
+   | here, drop of `foo` needs exclusive access to `foo.data`, because the type `Foo<Concrete<'_>>` implements the `Drop` trait
    | borrow later used here, when `foo` is dropped
    |
+   = note: consider using a `let` binding to create a longer lived value
    = note: values in a scope are dropped in the opposite order they are defined
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0597`.
+For more information about this error, try `rustc --explain E0713`.