summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/enum-drop-access.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/nll/enum-drop-access.stderr
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/nll/enum-drop-access.stderr')
-rw-r--r--tests/ui/nll/enum-drop-access.stderr31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/nll/enum-drop-access.stderr b/tests/ui/nll/enum-drop-access.stderr
new file mode 100644
index 000000000..a532ae121
--- /dev/null
+++ b/tests/ui/nll/enum-drop-access.stderr
@@ -0,0 +1,31 @@
+error[E0713]: borrow may still be in use when destructor runs
+ --> $DIR/enum-drop-access.rs:13:31
+ |
+LL | fn drop_enum(opt: DropOption<&mut i32>) -> Option<&mut i32> {
+ | - let's call the lifetime of this reference `'1`
+LL | match opt {
+LL | DropOption::Some(&mut ref mut r) => {
+ | ^^^^^^^^^
+LL | Some(r)
+ | ------- returning this value requires that `*opt.0` is borrowed for `'1`
+...
+LL | }
+ | - here, drop of `opt` needs exclusive access to `*opt.0`, because the type `DropOption<&mut i32>` implements the `Drop` trait
+
+error[E0713]: borrow may still be in use when destructor runs
+ --> $DIR/enum-drop-access.rs:22:36
+ |
+LL | fn optional_drop_enum(opt: Option<DropOption<&mut i32>>) -> Option<&mut i32> {
+ | - let's call the lifetime of this reference `'1`
+LL | match opt {
+LL | Some(DropOption::Some(&mut ref mut r)) => {
+ | ^^^^^^^^^
+LL | Some(r)
+ | ------- returning this value requires that `*opt.0.0` is borrowed for `'1`
+...
+LL | }
+ | - here, drop of `opt` needs exclusive access to `*opt.0.0`, because the type `DropOption<&mut i32>` implements the `Drop` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0713`.