2019-09-25 12:58:41 +00:00
|
|
|
//@ edition:2018
|
2021-10-12 16:10:05 +00:00
|
|
|
#![feature(must_not_suspend)]
|
|
|
|
#![allow(must_not_suspend)]
|
2019-09-25 12:58:41 +00:00
|
|
|
|
2019-10-06 22:14:34 +00:00
|
|
|
// This tests the basic example case for the async-await-specific error.
|
2019-09-25 12:58:41 +00:00
|
|
|
|
2019-10-06 22:14:34 +00:00
|
|
|
use std::sync::Mutex;
|
2019-09-25 12:58:41 +00:00
|
|
|
|
2019-10-06 22:14:34 +00:00
|
|
|
fn is_send<T: Send>(t: T) { }
|
2019-09-25 12:58:41 +00: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 22:14:34 +00:00
|
|
|
async fn baz() { }
|
2019-09-25 12:58:41 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
is_send(foo());
|
2019-10-06 22:14:34 +00:00
|
|
|
//~^ ERROR future cannot be sent between threads safely
|
2019-09-25 12:58:41 +00:00
|
|
|
}
|