|
1 |
| -error[E0597]: `mutex` does not live long enough |
2 |
| - --> $DIR/span-semicolon-issue-139049.rs:39:27 |
| 1 | +error[E0597]: `l` does not live long enough |
| 2 | + --> $DIR/span-semicolon-issue-139049.rs:11:41 |
3 | 3 | |
|
4 |
| -LL | let mutex = Mutex; |
5 |
| - | ----- binding `mutex` declared here |
6 |
| -LL | write!(Out, "{}", mutex.lock()) |
7 |
| - | ^^^^^------- |
8 |
| - | | |
9 |
| - | borrowed value does not live long enough |
10 |
| - | a temporary with access to the borrow is created here ... |
| 4 | +LL | macro_rules! perform { ($e:expr) => { D(&$e).end() } } |
| 5 | + | --^^^- |
| 6 | + | | | |
| 7 | + | | borrowed value does not live long enough |
| 8 | + | a temporary with access to the borrow is created here ... |
11 | 9 | ...
|
12 |
| -LL | }; |
13 |
| - | -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard` |
14 |
| - | | |
15 |
| - | `mutex` dropped here while still borrowed |
| 10 | +LL | { let l = (); perform!(l) }; |
| 11 | + | - ----------- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` |
| 12 | + | | | | |
| 13 | + | | | `l` dropped here while still borrowed |
| 14 | + | | in this macro invocation |
| 15 | + | binding `l` declared here |
16 | 16 | |
|
| 17 | + = note: this error originates in the macro `perform` (in Nightly builds, run with -Z macro-backtrace for more info) |
17 | 18 | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
|
18 | 19 | |
|
19 |
| -LL | write!(Out, "{}", mutex.lock()); |
20 |
| - | + |
| 20 | +LL | { let l = (); perform!(l); }; |
| 21 | + | + |
21 | 22 |
|
22 |
| -error[E0597]: `mutex` does not live long enough |
23 |
| - --> $DIR/span-semicolon-issue-139049.rs:48:41 |
| 23 | +error[E0597]: `l` does not live long enough |
| 24 | + --> $DIR/span-semicolon-issue-139049.rs:11:41 |
24 | 25 | |
|
25 |
| -LL | let mutex = Mutex; |
26 |
| - | ----- binding `mutex` declared here |
27 |
| -LL | write!(std::io::stdout(), "{}", mutex.lock()) |
28 |
| - | ^^^^^------- |
29 |
| - | | |
30 |
| - | borrowed value does not live long enough |
31 |
| - | a temporary with access to the borrow is created here ... |
| 26 | +LL | macro_rules! perform { ($e:expr) => { D(&$e).end() } } |
| 27 | + | --^^^- |
| 28 | + | | | |
| 29 | + | | borrowed value does not live long enough |
| 30 | + | a temporary with access to the borrow is created here ... |
32 | 31 | ...
|
33 |
| -LL | }; |
34 |
| - | -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard` |
35 |
| - | | |
36 |
| - | `mutex` dropped here while still borrowed |
| 32 | +LL | let _x = { let l = (); perform!(l) }; |
| 33 | + | - ----------- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` |
| 34 | + | | | | |
| 35 | + | | | `l` dropped here while still borrowed |
| 36 | + | | in this macro invocation |
| 37 | + | binding `l` declared here |
37 | 38 | |
|
38 | 39 | = note: the temporary is part of an expression at the end of a block;
|
39 | 40 | consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
|
| 41 | + = note: this error originates in the macro `perform` (in Nightly builds, run with -Z macro-backtrace for more info) |
40 | 42 | help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
|
41 | 43 | |
|
42 |
| -LL | let x = write!(std::io::stdout(), "{}", mutex.lock()); x |
43 |
| - | +++++++ +++ |
| 44 | +LL | let _x = { let l = (); let x = perform!(l); x }; |
| 45 | + | +++++++ +++ |
44 | 46 |
|
45 | 47 | error: aborting due to 2 previous errors
|
46 | 48 |
|
|
0 commit comments