]>
Commit | Line | Data |
---|---|---|
e1599b0c XL |
1 | // edition:2018 |
2 | ||
60c5eb7d | 3 | // This tests the basic example case for the async-await-specific error. |
e1599b0c | 4 | |
60c5eb7d | 5 | use std::sync::Mutex; |
e1599b0c | 6 | |
60c5eb7d | 7 | fn is_send<T: Send>(t: T) { } |
e1599b0c XL |
8 | |
9 | async fn foo() { | |
10 | bar(&Mutex::new(22)).await; | |
11 | } | |
12 | ||
13 | async fn bar(x: &Mutex<u32>) { | |
14 | let g = x.lock().unwrap(); | |
15 | baz().await; | |
16 | } | |
17 | ||
60c5eb7d | 18 | async fn baz() { } |
e1599b0c XL |
19 | |
20 | fn main() { | |
21 | is_send(foo()); | |
60c5eb7d | 22 | //~^ ERROR future cannot be sent between threads safely |
e1599b0c | 23 | } |