rust/tests/ui/await_holding_lock.stderr
Andy Weiss 6c25c3c381 Lint for holding locks across await points
Fixes #4226

This introduces the lint await_holding_lock. For async functions, we iterate
over all types in generator_interior_types and look for types named MutexGuard,
RwLockReadGuard, or RwLockWriteGuard. If we find one then we emit a lint.
2020-04-21 21:07:43 -07:00

35 lines
881 B
Text

error: this MutexGuard is held across an 'await' point
--> $DIR/await_holding_lock.rs:7:9
|
LL | let guard = x.lock().unwrap();
| ^^^^^
|
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
note: these are all the await points this lock is held through
--> $DIR/await_holding_lock.rs:7:5
|
LL | / let guard = x.lock().unwrap();
LL | | baz().await
LL | | }
| |_^
error: this MutexGuard is held across an 'await' point
--> $DIR/await_holding_lock.rs:28:9
|
LL | let guard = x.lock().unwrap();
| ^^^^^
|
note: these are all the await points this lock is held through
--> $DIR/await_holding_lock.rs:28:5
|
LL | / let guard = x.lock().unwrap();
LL | |
LL | | let second = baz().await;
LL | |
... |
LL | | first + second + third
LL | | }
| |_^
error: aborting due to 2 previous errors