fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
2.7 KiB60 linesraw
1warning[E0713]: borrow may still be in use when destructor runs
2  --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:52:5
3   |
4LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
5   |              -- lifetime `'a` defined here
6LL |     &mut *s.0
7   |     ^^^^^^^^^ returning this value requires that `*s.0` is borrowed for `'a`
8...
9LL | }
10   | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
11   |
12   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
13   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
14   = note: for more information, try `rustc --explain E0729`
15
16warning[E0713]: borrow may still be in use when destructor runs
17  --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
18   |
19LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
20   |                    -- lifetime `'a` defined here
21LL |     &mut *(*s).0
22   |     ^^^^^^^^^^^^ returning this value requires that `*s.0` is borrowed for `'a`
23...
24LL | }
25   | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
26   |
27   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
28   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
29   = note: for more information, try `rustc --explain E0729`
30
31warning[E0713]: borrow may still be in use when destructor runs
32  --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:74:5
33   |
34LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
35   |                          -- lifetime `'a` defined here
36LL |     &mut *(**s).0
37   |     ^^^^^^^^^^^^^ returning this value requires that `*s.0` is borrowed for `'a`
38...
39LL | }
40   | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
41   |
42   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
43   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
44   = note: for more information, try `rustc --explain E0729`
45
46error: compilation successful
47  --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:81:1
48   |
49LL | / fn main() {
50LL | |     let mut x = 1;
51LL | |     {
52LL | |         let mut long_lived = Scribble(&mut x);
53...  |
54LL | |     *boxed_boxed_scribbled(Box::new(Box::new(Scribble(&mut x)))) += 10;
55LL | | }
56   | |_^
57
58error: aborting due to previous error
59
60For more information about this error, try `rustc --explain E0713`.