2019-09-25 07:58:41 -05:00
|
|
|
// edition:2018
|
2021-10-12 11:10:05 -05:00
|
|
|
#![feature(must_not_suspend)]
|
|
|
|
#![allow(must_not_suspend)]
|
2019-09-25 07:58:41 -05:00
|
|
|
|
2019-10-06 17:14:34 -05:00
|
|
|
// This tests the basic example case for the async-await-specific error.
|
2019-09-25 07:58:41 -05:00
|
|
|
|
2019-10-06 17:14:34 -05:00
|
|
|
use std::sync::Mutex;
|
2019-09-25 07:58:41 -05:00
|
|
|
|
2019-10-06 17:14:34 -05:00
|
|
|
fn is_send<T: Send>(t: T) { }
|
2019-09-25 07:58:41 -05:00
|
|
|
|
|
|
|
async fn foo() {
|
|
|
|
bar(&Mutex::new(22)).await;
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn bar(x: &Mutex<u32>) {
|
|
|
|
let g = x.lock().unwrap();
|
|
|
|
baz().await;
|
|
|
|
}
|
|
|
|
|
2019-10-06 17:14:34 -05:00
|
|
|
async fn baz() { }
|
2019-09-25 07:58:41 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
is_send(foo());
|
2019-10-06 17:14:34 -05:00
|
|
|
//~^ ERROR future cannot be sent between threads safely
|
2019-09-25 07:58:41 -05:00
|
|
|
}
|