]> git.lizzy.rs Git - rust.git/blob - tests/ui/macros/format-args-temporaries-in-write.stderr
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
[rust.git] / tests / ui / macros / format-args-temporaries-in-write.stderr
1 error[E0597]: `mutex` does not live long enough
2   --> $DIR/format-args-temporaries-in-write.rs:41:27
3    |
4 LL |         let mutex = Mutex;
5    |             ----- binding `mutex` declared here
6 LL |         write!(Out, "{}", mutex.lock()) /* no semicolon */
7    |                           ^^^^^^^^^^^^
8    |                           |
9    |                           borrowed value does not live long enough
10    |                           a temporary with access to the borrow is created here ...
11 LL |
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
16    |
17
18 error[E0597]: `mutex` does not live long enough
19   --> $DIR/format-args-temporaries-in-write.rs:47:29
20    |
21 LL |         let mutex = Mutex;
22    |             ----- binding `mutex` declared here
23 LL |         writeln!(Out, "{}", mutex.lock()) /* no semicolon */
24    |                             ^^^^^^^^^^^^
25    |                             |
26    |                             borrowed value does not live long enough
27    |                             a temporary with access to the borrow is created here ...
28 LL |
29 LL |     };
30    |     -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard`
31    |     |
32    |     `mutex` dropped here while still borrowed
33    |
34
35 error: aborting due to 2 previous errors
36
37 For more information about this error, try `rustc --explain E0597`.