summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/in-trait/async-associated-types2.rs
blob: e546a0579c66f2f5774bd9b98b00943575b6a259 (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
26
27
28
29
30
// check-pass
// edition: 2021

#![feature(async_fn_in_trait)]
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]

use std::future::Future;

trait MyTrait {
    type Fut<'a>: Future<Output = i32>
    where
        Self: 'a;

    fn foo<'a>(&'a self) -> Self::Fut<'a>;
}

impl MyTrait for i32 {
    type Fut<'a> = impl Future<Output = i32> + 'a
    where
        Self: 'a;

    fn foo<'a>(&'a self) -> Self::Fut<'a> {
        async {
            *self
        }
    }
}

fn main() {}