From 673cd6efbe176e85c1198d9640f457aef2a53071 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 18 Sep 2018 01:52:31 +0200 Subject: [PATCH] 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`.) --- .../borrowck-fn-in-const-c.nll.stderr | 8 +++--- ...96-scribble-on-boxed-borrow.migrate.stderr | 26 +++++++++---------- ...-45696-scribble-on-boxed-borrow.nll.stderr | 26 +++++++++---------- .../issue-45696-scribble-on-boxed-borrow.rs | 12 ++++----- src/test/ui/nll/issue-31567.rs | 2 +- src/test/ui/nll/issue-31567.stderr | 10 +++---- .../span/borrowck-ref-into-rvalue.nll.stderr | 12 ++++----- .../ui/span/issue28498-reject-ex1.nll.stderr | 9 ++++--- 8 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr index 827b66cf068b..5c70294a1b90 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr @@ -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`. diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr index da0dfac2d18b..70d819f0f467 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr @@ -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>) -> &'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`. diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr index 09cbc2f94512..72ec5affb182 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr @@ -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>) -> &'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>>) -> &'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`. diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs index 5a4874249e2f..2af05172d24d 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs @@ -60,8 +60,8 @@ fn boxed_boxed_borrowed_scribble<'a>(s: Box>) -> &'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>) -> &'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>) -> &'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>>) -> &'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 } diff --git a/src/test/ui/nll/issue-31567.rs b/src/test/ui/nll/issue-31567.rs index a0d1faf1f0e8..3508f3033e62 100644 --- a/src/test/ui/nll/issue-31567.rs +++ b/src/test/ui/nll/issue-31567.rs @@ -19,7 +19,7 @@ struct VecWrapper<'a>(&'a mut S); struct S(Box); 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 } diff --git a/src/test/ui/nll/issue-31567.stderr b/src/test/ui/nll/issue-31567.stderr index 532bc493e7db..63330f303198 100644 --- a/src/test/ui/nll/issue-31567.stderr +++ b/src/test/ui/nll/issue-31567.stderr @@ -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`. diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr index c565842c2c00..c94558f12bbd 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr +++ b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr @@ -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`. diff --git a/src/test/ui/span/issue28498-reject-ex1.nll.stderr b/src/test/ui/span/issue28498-reject-ex1.nll.stderr index 27eb4a3afed6..1f72b78ebc76 100644 --- a/src/test/ui/span/issue28498-reject-ex1.nll.stderr +++ b/src/test/ui/span/issue28498-reject-ex1.nll.stderr @@ -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>` 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`.