summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/if_let_mutex.stderr
blob: 8a4d5dbac592b33d12a0d3b0061413a719e17248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
  --> $DIR/if_let_mutex.rs:10:5
   |
LL |       if let Err(locked) = m.lock() {
   |       ^                    - this Mutex will remain locked for the entire `if let`-block...
   |  _____|
   | |
LL | |         do_stuff(locked);
LL | |     } else {
LL | |         let lock = m.lock().unwrap();
   | |                    - ... and is tried to lock again here, which will always deadlock.
LL | |         do_stuff(lock);
LL | |     };
   | |_____^
   |
   = note: `-D clippy::if-let-mutex` implied by `-D warnings`
   = help: move the lock call outside of the `if let ...` expression

error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
  --> $DIR/if_let_mutex.rs:22:5
   |
LL |       if let Some(locked) = m.lock().unwrap().deref() {
   |       ^                     - this Mutex will remain locked for the entire `if let`-block...
   |  _____|
   | |
LL | |         do_stuff(locked);
LL | |     } else {
LL | |         let lock = m.lock().unwrap();
   | |                    - ... and is tried to lock again here, which will always deadlock.
LL | |         do_stuff(lock);
LL | |     };
   | |_____^
   |
   = help: move the lock call outside of the `if let ...` expression

error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
  --> $DIR/if_let_mutex.rs:43:5
   |
LL |       if let Ok(i) = mutex.lock() {
   |       ^              ----- this Mutex will remain locked for the entire `if let`-block...
   |  _____|
   | |
LL | |         do_stuff(i);
LL | |     } else {
LL | |         let _x = mutex.lock();
   | |                  ----- ... and is tried to lock again here, which will always deadlock.
LL | |     };
   | |_____^
   |
   = help: move the lock call outside of the `if let ...` expression

error: aborting due to 3 previous errors