summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
blob: 792f378cb57f1d015aab86757afcb7a4cc33888a (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
// edition:2021

// RPITIT is not enough to allow use of async functions
#![allow(incomplete_features)]
#![feature(return_position_impl_trait_in_trait)]

trait T {
    async fn foo(); //~ ERROR functions in traits cannot be declared `async`
}

// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
// feature-gate-return_position_impl_trait_in_trait.rs)
trait T2 {
    async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async`
}

trait T3 {
    fn foo() -> impl std::future::Future<Output = ()>;
}

impl T3 for () {
    async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
}

fn main() {}