]> git.proxmox.com Git - rustc.git/blame - tests/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr
New upstream version 1.76.0+dfsg1
[rustc.git] / tests / ui / nll / issue-54556-temps-in-tail-diagnostic.stderr
CommitLineData
0bf4aa26 1error[E0597]: `_thing1` does not live long enough
48663c56 2 --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11
0bf4aa26 3 |
9ffffee4
FG
4LL | let mut _thing1 = D(Box::new("thing1"));
5 | ----------- binding `_thing1` declared here
6LL | // D("other").next(&_thing1).end()
532ac7d7 7LL | 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
12LL | }
13 | - `_thing1` dropped here while still borrowed
923072b8 14LL |
0bf4aa26 15LL | ;
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
18help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
19 |
20LL | D(&_thing1).end();
94222f64 21 | +
0bf4aa26 22
4b012472 23error: aborting due to 1 previous error
0bf4aa26
XL
24
25For more information about this error, try `rustc --explain E0597`.