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

#![feature(return_type_notation, async_fn_in_trait)]
//~^ WARN the feature `return_type_notation` 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() {}