]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/must_not_suspend/issue-89562.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / lint / must_not_suspend / issue-89562.rs
1 // edition:2018
2 // run-pass
3
4 use std::sync::Mutex;
5
6 // Copied from the issue. Allow-by-default for now, so run-pass
7 pub async fn foo() {
8     let foo = Mutex::new(1);
9     let lock = foo.lock().unwrap();
10
11     // Prevent mutex lock being held across `.await` point.
12     drop(lock);
13
14     bar().await;
15 }
16
17 async fn bar() {}
18
19 fn main() {}