From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- ...059-report-when-borrow-and-drop-conflict.stderr | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr (limited to 'tests/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr') diff --git a/tests/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr b/tests/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr new file mode 100644 index 000000000..7f9cbc3c3 --- /dev/null +++ b/tests/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr @@ -0,0 +1,48 @@ +error[E0713]: borrow may still be in use when destructor runs + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:11:5 + | +LL | fn finish_1(s: S) -> &mut String { + | - has type `S<'1>` +LL | s.url + | ^^^^^ returning this value requires that `*s.url` is borrowed for `'1` +LL | } + | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait + +error[E0713]: borrow may still be in use when destructor runs + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:16:13 + | +LL | fn finish_2(s: S) -> &mut String { + | - has type `S<'1>` +LL | let p = &mut *s.url; p + | ^^^^^^^^^^^ - returning this value requires that `*s.url` is borrowed for `'1` +LL | } + | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait + +error[E0713]: borrow may still be in use when destructor runs + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:21:21 + | +LL | fn finish_3(s: S) -> &mut String { + | - has type `S<'1>` +LL | let p: &mut _ = s.url; p + | ^^^^^ - returning this value requires that `*s.url` is borrowed for `'1` +LL | } + | - here, drop of `s` needs exclusive access to `*s.url`, because the type `S<'_>` implements the `Drop` trait + +error[E0509]: cannot move out of type `S<'_>`, which implements the `Drop` trait + --> $DIR/issue-52059-report-when-borrow-and-drop-conflict.rs:26:13 + | +LL | let p = s.url; p + | ^^^^^ + | | + | cannot move out of here + | move occurs because `s.url` has type `&mut String`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let p = &s.url; p + | + + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0509, E0713. +For more information about an error, try `rustc --explain E0509`. -- cgit v1.2.3