]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/in-trait/fn-not-async-err2.rs
Rollup merge of #102215 - alexcrichton:wasm-link-whole-archive, r=estebank
[rust.git] / src / test / ui / async-await / in-trait / fn-not-async-err2.rs
1 // edition: 2021
2
3 #![feature(async_fn_in_trait)]
4 #![allow(incomplete_features)]
5
6 use std::future::Future;
7
8 trait MyTrait {
9     async fn foo(&self) -> i32;
10 }
11
12 impl MyTrait for i32 {
13     fn foo(&self) -> impl Future<Output = i32> {
14         //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return [E0562]
15         async {
16             *self
17         }
18     }
19 }
20
21 fn main() {}