]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
[rust.git] / src / test / ui / type-alias-impl-trait / issue-62000-associate-impl-trait-lifetimes.rs
1 // Regression test for #62988
2
3 // check-pass
4
5 #![feature(type_alias_impl_trait)]
6
7 trait MyTrait {
8     type AssocType: Send;
9     fn ret(&self) -> Self::AssocType;
10 }
11
12 impl MyTrait for () {
13     type AssocType = impl Send;
14     fn ret(&self) -> Self::AssocType {
15         ()
16     }
17 }
18
19 impl<'a> MyTrait for &'a () {
20     type AssocType = impl Send;
21     fn ret(&self) -> Self::AssocType {
22         ()
23     }
24 }
25
26 trait MyLifetimeTrait<'a> {
27     type AssocType: Send + 'a;
28     fn ret(&self) -> Self::AssocType;
29 }
30
31 impl<'a> MyLifetimeTrait<'a> for &'a () {
32     type AssocType = impl Send + 'a;
33     fn ret(&self) -> Self::AssocType {
34         *self
35     }
36 }
37
38 fn main() {}