]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-64130-2-send.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / async-await / issue-64130-2-send.rs
1 // revisions: no_drop_tracking drop_tracking drop_tracking_mir
2 // [drop_tracking] compile-flags: -Zdrop-tracking
3 // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
4 #![feature(negative_impls)]
5 // edition:2018
6
7 // This tests the specialized async-await-specific error when futures don't implement an
8 // auto trait (which is specifically Send) due to some type that was captured.
9
10 struct Foo;
11
12 impl !Send for Foo {}
13
14 fn is_send<T: Send>(t: T) { }
15
16 async fn bar() {
17     let x = Box::new(Foo);
18     baz().await;
19 }
20
21 async fn baz() { }
22
23 fn main() {
24     is_send(bar());
25     //~^ ERROR future cannot be sent between threads safely
26 }