File: enum-drop-access.stderr

package info (click to toggle)
rustc 1.70.0%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 722,120 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,001; asm: 2,856
file content (31 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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`.