summaryrefslogtreecommitdiff
path: root/tests/ui/associated-type-bounds/return-type-notation/basic.rs
blob: 0b7530b65d758e4d3dfd46c4fe8fa57f460c2b14 (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
28
// revisions: with without
// edition: 2021
//[with] check-pass

#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` is incomplete
//~| WARN the feature `async_fn_in_trait` is incomplete

trait Foo {
    async fn method() -> Result<(), ()>;
}

async fn foo<T: Foo>() -> Result<(), ()> {
    T::method().await?;
    Ok(())
}

fn is_send(_: impl Send) {}

fn test<
    #[cfg(with)] T: Foo<method(): Send>,
    #[cfg(without)] T: Foo,
>() {
    is_send(foo::<T>());
    //[without]~^ ERROR future cannot be sent between threads safely
}

fn main() {}