summaryrefslogtreecommitdiffstats
path: root/src/test/ui/lint/must_not_suspend/issue-89562.rs
blob: acdb36fcdabf9d97b4ff9cd521e8d47cf7fa7c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// edition:2018
// run-pass

use std::sync::Mutex;

// Copied from the issue. Allow-by-default for now, so run-pass
pub async fn foo() {
    let foo = Mutex::new(1);
    let lock = foo.lock().unwrap();

    // Prevent mutex lock being held across `.await` point.
    drop(lock);

    bar().await;
}

async fn bar() {}

fn main() {}