]>
Commit | Line | Data |
---|---|---|
0bf4aa26 | 1 | error[E0597]: `_thing1` does not live long enough |
48663c56 | 2 | --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 |
0bf4aa26 | 3 | | |
9ffffee4 FG |
4 | LL | let mut _thing1 = D(Box::new("thing1")); |
5 | | ----------- binding `_thing1` declared here | |
6 | LL | // D("other").next(&_thing1).end() | |
532ac7d7 | 7 | LL | D(&_thing1).end() |
48663c56 XL |
8 | | --^^^^^^^^- |
9 | | | | | |
10 | | | borrowed value does not live long enough | |
11 | | a temporary with access to the borrow is created here ... | |
0bf4aa26 XL |
12 | LL | } |
13 | | - `_thing1` dropped here while still borrowed | |
923072b8 | 14 | LL | |
0bf4aa26 | 15 | LL | ; |
48663c56 XL |
16 | | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` |
17 | | | |
f9f354fc XL |
18 | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped |
19 | | | |
20 | LL | D(&_thing1).end(); | |
94222f64 | 21 | | + |
0bf4aa26 | 22 | |
4b012472 | 23 | error: aborting due to 1 previous error |
0bf4aa26 XL |
24 | |
25 | For more information about this error, try `rustc --explain E0597`. |