]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/in-trait/async-example-desugared-manual.rs
Rollup merge of #105481 - lqd:mono-stats, r=wesleywiser
[rust.git] / src / test / ui / async-await / in-trait / async-example-desugared-manual.rs
1 // edition: 2021
2
3 #![feature(async_fn_in_trait)]
4 #![feature(return_position_impl_trait_in_trait)]
5 #![allow(incomplete_features)]
6
7 use std::future::Future;
8 use std::task::Poll;
9
10 trait MyTrait {
11     async fn foo(&self) -> i32;
12 }
13
14 struct MyFuture;
15 impl Future for MyFuture {
16     type Output = i32;
17     fn poll(self: std::pin::Pin<&mut Self>, _: &mut std::task::Context<'_>) -> Poll<Self::Output> {
18         Poll::Ready(0)
19     }
20 }
21
22 impl MyTrait for u32 {
23     fn foo(&self) -> MyFuture {
24         //~^ ERROR method `foo` should be async
25         MyFuture
26     }
27 }
28
29 fn main() {}