summaryrefslogtreecommitdiff
path: root/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs
blob: f115e1433182cad6088b4635ea98551ced874aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir
// edition: 2021
// revisions: pass fail
//[pass] check-pass

#![feature(negative_impls)]

struct NotSync;
impl !Sync for NotSync {}

async fn foo() {
    #[cfg(pass)]
    let x = &();
    #[cfg(fail)]
    let x = &NotSync;
    bar().await;
    #[allow(drop_ref)]
    drop(x);
}

async fn bar() {}

fn main() {
    fn is_send(_: impl Send) {}
    is_send(foo());
    //[fail]~^ ERROR `impl Future<Output = ()>` cannot be sent between threads safely
}