Updates to tests reflecting the diangostic changes in previous commit.

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`.)
This commit is contained in:
Felix S. Klock II 2018-09-18 01:52:31 +02:00
parent 1f0fbddfff
commit 673cd6efbe
8 changed files with 53 additions and 52 deletions

View 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`.

View 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`.

View 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`.

View 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
}

View file

@ -19,7 +19,7 @@ struct VecWrapper<'a>(&'a mut S);
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
}

View 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`.

View 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`.

View 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`.