]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/in-trait/async-associated-types2.rs
Rollup merge of #105482 - wesleywiser:fix_debuginfo_ub, r=tmiasko
[rust.git] / src / test / ui / async-await / in-trait / async-associated-types2.rs
1 // check-pass
2 // edition: 2021
3
4 #![feature(async_fn_in_trait)]
5 #![feature(type_alias_impl_trait)]
6 #![allow(incomplete_features)]
7
8 use std::future::Future;
9
10 trait MyTrait {
11     type Fut<'a>: Future<Output = i32>
12     where
13         Self: 'a;
14
15     fn foo<'a>(&'a self) -> Self::Fut<'a>;
16 }
17
18 impl MyTrait for i32 {
19     type Fut<'a> = impl Future<Output = i32> + 'a
20     where
21         Self: 'a;
22
23     fn foo<'a>(&'a self) -> Self::Fut<'a> {
24         async {
25             *self
26         }
27     }
28 }
29
30 fn main() {}