fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1008 B26 linesraw
1error[E0597]: `counter` does not live long enough
2  --> $DIR/issue-54556-niconii.rs:22:20
3   |
4LL |     let counter = Mutex;
5   |         ------- binding `counter` declared here
6LL |
7LL |     if let Ok(_) = counter.lock() { }
8   |                    ^^^^^^^-------
9   |                    |
10   |                    borrowed value does not live long enough
11   |                    a temporary with access to the borrow is created here ...
12...
13LL | }
14   | -
15   | |
16   | `counter` dropped here while still borrowed
17   | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Result<MutexGuard<'_>, ()>`
18   |
19help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
20   |
21LL |     if let Ok(_) = counter.lock() { };
22   |                                      +
23
24error: aborting due to previous error
25
26For more information about this error, try `rustc --explain E0597`.