]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-64130-1-sync.rs
Rollup merge of #107203 - chenyukang:yukang/fix-106496-remove-deref, r=compiler-errors
[rust.git] / tests / ui / async-await / issue-64130-1-sync.rs
1 #![feature(negative_impls)]
2 // edition:2018
3
4 // This tests the specialized async-await-specific error when futures don't implement an
5 // auto trait (which is specifically Sync) due to some type that was captured.
6
7 struct Foo;
8
9 impl !Sync for Foo {}
10
11 fn is_sync<T: Sync>(t: T) { }
12
13 async fn bar() {
14     let x = Foo;
15     baz().await;
16 }
17
18 async fn baz() { }
19
20 fn main() {
21     is_sync(bar());
22     //~^ ERROR future cannot be shared between threads safely
23 }