about summary refs log tree commit diff
path: root/src/test/ui/span
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-23 04:06:15 +0000
committerbors <bors@rust-lang.org>2018-09-23 04:06:15 +0000
commit7714c430ae1f771001fc0a1b083752485baba56e (patch)
treefe9d0752e00e3910994223686d8ce91408cf313d /src/test/ui/span
parent576b640a02d7363746aacab9d2f1b91c6b685688 (diff)
parentc9cf4993307b9623580b1fe7f12aa87df1225fb8 (diff)
downloadrust-7714c430ae1f771001fc0a1b083752485baba56e.tar.gz
rust-7714c430ae1f771001fc0a1b083752485baba56e.zip
Auto merge of #54310 - pnkfelix:issue-52059-report-borrow-drop-conflict, r=nikomatsakis
Report when borrow could cause `&mut` aliasing during Drop

We were already issuing an error for the cases where this cropped up, so this is not fixing any soundness holes. The previous diagnostic just wasn't accurately describing the problem in the user's code.

Fix #52059
Diffstat (limited to 'src/test/ui/span')
-rw-r--r--src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr12
-rw-r--r--src/test/ui/span/issue28498-reject-ex1.nll.stderr9
2 files changed, 11 insertions, 10 deletions
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 c565842c2c0..c94558f12bb 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 27eb4a3afed..1f72b78ebc7 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<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`.