]> git.proxmox.com Git - rustc.git/blame - src/test/ui/async-await/issue-64130-non-send-future-diags.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / async-await / issue-64130-non-send-future-diags.rs
CommitLineData
e1599b0c
XL
1// edition:2018
2
60c5eb7d 3// This tests the basic example case for the async-await-specific error.
e1599b0c 4
60c5eb7d 5use std::sync::Mutex;
e1599b0c 6
60c5eb7d 7fn is_send<T: Send>(t: T) { }
e1599b0c
XL
8
9async fn foo() {
10 bar(&Mutex::new(22)).await;
11}
12
13async fn bar(x: &Mutex<u32>) {
14 let g = x.lock().unwrap();
15 baz().await;
16}
17
60c5eb7d 18async fn baz() { }
e1599b0c
XL
19
20fn main() {
21 is_send(foo());
60c5eb7d 22 //~^ ERROR future cannot be sent between threads safely
e1599b0c 23}