]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-64130-non-send-future-diags.rs
Rollup merge of #107065 - flip1995:clippyup, r=Manishearth
[rust.git] / tests / ui / async-await / issue-64130-non-send-future-diags.rs
1 // edition:2018
2 #![feature(must_not_suspend)]
3 #![allow(must_not_suspend)]
4
5 // This tests the basic example case for the async-await-specific error.
6
7 use std::sync::Mutex;
8
9 fn is_send<T: Send>(t: T) { }
10
11 async fn foo() {
12     bar(&Mutex::new(22)).await;
13 }
14
15 async fn bar(x: &Mutex<u32>) {
16     let g = x.lock().unwrap();
17     baz().await;
18 }
19
20 async fn baz() { }
21
22 fn main() {
23     is_send(foo());
24     //~^ ERROR future cannot be sent between threads safely
25 }