]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/feature-gate-async_fn_in_trait.rs
Rollup merge of #107065 - flip1995:clippyup, r=Manishearth
[rust.git] / tests / ui / async-await / feature-gate-async_fn_in_trait.rs
1 // edition:2021
2
3 // RPITIT is not enough to allow use of async functions
4 #![allow(incomplete_features)]
5 #![feature(return_position_impl_trait_in_trait)]
6
7 trait T {
8     async fn foo(); //~ ERROR functions in traits cannot be declared `async`
9 }
10
11 // Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
12 // feature-gate-return_position_impl_trait_in_trait.rs)
13 trait T2 {
14     async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async`
15 }
16
17 trait T3 {
18     fn foo() -> impl std::future::Future<Output = ()>;
19 }
20
21 impl T3 for () {
22     async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
23 }
24
25 fn main() {}