]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / test / ui / type-alias-impl-trait / issue-67844-nested-opaque.rs
1 // check-pass
2 // Regression test for issue #67844
3 // Ensures that we properly handle nested TAIT occurrences
4 // with generic parameters
5
6 #![feature(type_alias_impl_trait)]
7
8 trait WithAssoc { type AssocType; }
9
10 trait WithParam<A> {}
11
12 type Return<A> = impl WithAssoc<AssocType = impl WithParam<A>>;
13
14 struct MyParam;
15 impl<A> WithParam<A> for MyParam {}
16
17 struct MyStruct;
18
19 impl WithAssoc for MyStruct {
20     type AssocType = MyParam;
21 }
22
23
24 fn my_fun<A>() -> Return<A> {
25     MyStruct
26 }
27
28 fn my_other_fn<A>() -> impl WithAssoc<AssocType = impl WithParam<A>> {
29     MyStruct
30 }
31
32 fn main() {}