]> git.proxmox.com Git - rustc.git/blame - tests/ui/async-await/in-trait/async-associated-types.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / tests / ui / async-await / in-trait / async-associated-types.rs
CommitLineData
487cf647 1// check-pass
2b03887a 2// edition: 2021
353b0b11
FG
3// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
4// revisions: current next
2b03887a
FG
5
6#![feature(async_fn_in_trait)]
487cf647 7#![feature(impl_trait_projections)]
2b03887a
FG
8#![allow(incomplete_features)]
9
10use std::fmt::Debug;
11
12trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b {
13 type MyAssoc;
14
15 async fn foo(&'a self, key: &'b T) -> Self::MyAssoc;
16}
17
18impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U {
19 type MyAssoc = (&'a U, &'b T);
20
21 async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) {
22 (self, key)
23 }
24}
25
26fn main() {}