File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
src/test/ui/lint/must_not_suspend Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 11// edition:2018
2- #![ feature( must_not_suspend) ]
32#![ deny( must_not_suspend) ]
43
54async fn other ( ) { }
Original file line number Diff line number Diff line change 11error: `MutexGuard` held across a suspend point, but should not be
2- --> $DIR/mutex.rs:8 :9
2+ --> $DIR/mutex.rs:7 :9
33 |
44LL | let _guard = m.lock().unwrap();
55 | ^^^^^^
66LL | other().await;
77 | ------------- the value is held across this suspend point
88 |
99note: the lint level is defined here
10- --> $DIR/mutex.rs:3 :9
10+ --> $DIR/mutex.rs:2 :9
1111 |
1212LL | #![deny(must_not_suspend)]
1313 | ^^^^^^^^^^^^^^^^
1414note: Holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Future's to not implement `Send`
15- --> $DIR/mutex.rs:8 :9
15+ --> $DIR/mutex.rs:7 :9
1616 |
1717LL | let _guard = m.lock().unwrap();
1818 | ^^^^^^
1919help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
20- --> $DIR/mutex.rs:8 :9
20+ --> $DIR/mutex.rs:7 :9
2121 |
2222LL | let _guard = m.lock().unwrap();
2323 | ^^^^^^
You can’t perform that action at this time.
0 commit comments