Skip to content

Commit 673cd6e

Browse files
committed
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`.)
1 parent 1f0fbdd commit 673cd6e

8 files changed

+53
-52
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
error[E0597]: `local.inner` does not live long enough
1+
error[E0713]: borrow may still be in use when destructor runs
22
--> $DIR/borrowck-fn-in-const-c.rs:27:16
33
|
44
LL | return &local.inner; //~ ERROR does not live long enough
5-
| ^^^^^^^^^^^^ borrowed value does not live long enough
5+
| ^^^^^^^^^^^^
66
LL | }
7-
| - `local.inner` dropped here while still borrowed
7+
| - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait
88
|
99
= note: borrowed value must be valid for the static lifetime...
1010

1111
error: aborting due to previous error
1212

13-
For more information about this error, try `rustc --explain E0597`.
13+
For more information about this error, try `rustc --explain E0713`.

src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
warning[E0597]: `*s.0` does not live long enough
1+
warning[E0713]: borrow may still be in use when destructor runs
22
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
33
|
4-
LL | &mut *s.0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
5-
| ^^^^^^^^^ borrowed value does not live long enough
4+
LL | &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
5+
| ^^^^^^^^^
66
...
77
LL | }
8-
| - `*s.0` dropped here while still borrowed
8+
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
99
|
1010
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 62:14...
1111
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:14
@@ -16,14 +16,14 @@ LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
1616
It represents potential unsoundness in your code.
1717
This warning will become a hard error in the future.
1818

19-
warning[E0597]: `*s.0` does not live long enough
19+
warning[E0713]: borrow may still be in use when destructor runs
2020
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
2121
|
22-
LL | &mut *(*s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
23-
| ^^^^^^^^^^^^ borrowed value does not live long enough
22+
LL | &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
23+
| ^^^^^^^^^^^^
2424
...
2525
LL | }
26-
| - `*s.0` dropped here while still borrowed
26+
| - here, drop of `*s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
2727
|
2828
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 72:20...
2929
--> $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 {
3434
It represents potential unsoundness in your code.
3535
This warning will become a hard error in the future.
3636

37-
warning[E0597]: `*s.0` does not live long enough
37+
warning[E0713]: borrow may still be in use when destructor runs
3838
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5
3939
|
40-
LL | &mut *(**s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
41-
| ^^^^^^^^^^^^^ borrowed value does not live long enough
40+
LL | &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
41+
| ^^^^^^^^^^^^^
4242
...
4343
LL | }
44-
| - `*s.0` dropped here while still borrowed
44+
| - here, drop of `**s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
4545
|
4646
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 82:26...
4747
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:26
@@ -66,4 +66,4 @@ LL | | }
6666

6767
error: aborting due to previous error
6868

69-
For more information about this error, try `rustc --explain E0597`.
69+
For more information about this error, try `rustc --explain E0713`.
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
error[E0597]: `*s.0` does not live long enough
1+
error[E0713]: borrow may still be in use when destructor runs
22
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
33
|
4-
LL | &mut *s.0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
5-
| ^^^^^^^^^ borrowed value does not live long enough
4+
LL | &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
5+
| ^^^^^^^^^
66
...
77
LL | }
8-
| - `*s.0` dropped here while still borrowed
8+
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
99
|
1010
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 62:14...
1111
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:14
1212
|
1313
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
1414
| ^^
1515

16-
error[E0597]: `*s.0` does not live long enough
16+
error[E0713]: borrow may still be in use when destructor runs
1717
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
1818
|
19-
LL | &mut *(*s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
20-
| ^^^^^^^^^^^^ borrowed value does not live long enough
19+
LL | &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
20+
| ^^^^^^^^^^^^
2121
...
2222
LL | }
23-
| - `*s.0` dropped here while still borrowed
23+
| - here, drop of `*s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
2424
|
2525
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 72:20...
2626
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:72:20
2727
|
2828
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
2929
| ^^
3030

31-
error[E0597]: `*s.0` does not live long enough
31+
error[E0713]: borrow may still be in use when destructor runs
3232
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5
3333
|
34-
LL | &mut *(**s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
35-
| ^^^^^^^^^^^^^ borrowed value does not live long enough
34+
LL | &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
35+
| ^^^^^^^^^^^^^
3636
...
3737
LL | }
38-
| - `*s.0` dropped here while still borrowed
38+
| - here, drop of `**s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
3939
|
4040
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 82:26...
4141
--> $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 {
4545

4646
error: aborting due to 3 previous errors
4747

48-
For more information about this error, try `rustc --explain E0597`.
48+
For more information about this error, try `rustc --explain E0713`.

src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ fn boxed_boxed_borrowed_scribble<'a>(s: Box<Box<&'a mut Scribble>>) -> &'a mut u
6060
// this should be an error. (Which is perhaps the essence of why
6161
// rust-lang/rust#45696 arose in the first place.)
6262
fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
63-
&mut *s.0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
64-
//[migrate]~^ WARNING `*s.0` does not live long enough [E0597]
63+
&mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
64+
//[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
6565
//[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility
6666
}
6767

@@ -70,8 +70,8 @@ fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
7070
// (But again, AST-borrowck was not smart enogh to know that this
7171
// should be an error.)
7272
fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
73-
&mut *(*s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
74-
//[migrate]~^ WARNING `*s.0` does not live long enough [E0597]
73+
&mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
74+
//[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
7575
//[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility
7676
}
7777

@@ -80,8 +80,8 @@ fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
8080
// (But again, AST-borrowck was not smart enogh to know that this
8181
// should be an error.)
8282
fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
83-
&mut *(**s).0 //[nll]~ ERROR `*s.0` does not live long enough [E0597]
84-
//[migrate]~^ WARNING `*s.0` does not live long enough [E0597]
83+
&mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713]
84+
//[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713]
8585
//[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility
8686
}
8787

src/test/ui/nll/issue-31567.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct VecWrapper<'a>(&'a mut S);
1919
struct S(Box<u32>);
2020

2121
fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
22-
let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
22+
let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713]
2323
&s_inner.0
2424
}
2525

src/test/ui/nll/issue-31567.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0597]: `*v.0` does not live long enough
1+
error[E0713]: borrow may still be in use when destructor runs
22
--> $DIR/issue-31567.rs:22:26
33
|
4-
LL | let s_inner: &'a S = &*v.0; //~ ERROR `*v.0` does not live long enough
5-
| ^^^^^ borrowed value does not live long enough
4+
LL | let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713]
5+
| ^^^^^
66
LL | &s_inner.0
77
LL | }
8-
| - `*v.0` dropped here while still borrowed
8+
| - here, drop of `v` needs exclusive access to `*v.0`, because the type `VecWrapper<'_>` implements the `Drop` trait
99
|
1010
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:17...
1111
--> $DIR/issue-31567.rs:21:17
@@ -15,4 +15,4 @@ LL | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
1515

1616
error: aborting due to previous error
1717

18-
For more information about this error, try `rustc --explain E0597`.
18+
For more information about this error, try `rustc --explain E0713`.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
error[E0597]: borrowed value does not live long enough
2-
--> $DIR/borrowck-ref-into-rvalue.rs:13:11
1+
error[E0713]: borrow may still be in use when destructor runs
2+
--> $DIR/borrowck-ref-into-rvalue.rs:14:14
33
|
4-
LL | match Some("Hello".to_string()) {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
4+
LL | Some(ref m) => {
5+
| ^^^^^
66
...
77
LL | }
8-
| - temporary value only lives until here
8+
| - drop of temporary value occurs here
99
LL | println!("{}", *msg);
1010
| ---- borrow later used here
1111
|
1212
= note: consider using a `let` binding to create a longer lived value
1313

1414
error: aborting due to previous error
1515

16-
For more information about this error, try `rustc --explain E0597`.
16+
For more information about this error, try `rustc --explain E0713`.
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
error[E0597]: `foo.data` does not live long enough
1+
error[E0713]: borrow may still be in use when destructor runs
22
--> $DIR/issue28498-reject-ex1.rs:44:29
33
|
44
LL | foo.data[0].1.set(Some(&foo.data[1]));
5-
| ^^^^^^^^ borrowed value does not live long enough
5+
| ^^^^^^^^
66
...
77
LL | }
88
| -
99
| |
10-
| `foo.data` dropped here while still borrowed
10+
| here, drop of `foo` needs exclusive access to `foo.data`, because the type `Foo<Concrete<'_>>` implements the `Drop` trait
1111
| borrow later used here, when `foo` is dropped
1212
|
13+
= note: consider using a `let` binding to create a longer lived value
1314
= note: values in a scope are dropped in the opposite order they are defined
1415

1516
error: aborting due to previous error
1617

17-
For more information about this error, try `rustc --explain E0597`.
18+
For more information about this error, try `rustc --explain E0713`.

0 commit comments

Comments
 (0)