]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/issue-67844-nested-opaque.rs
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
[rust.git] / tests / 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 {
9     type AssocType;
10 }
11
12 trait WithParam<A> {}
13
14 type Return<A> = impl WithAssoc<AssocType = impl WithParam<A>>;
15
16 struct MyParam;
17 impl<A> WithParam<A> for MyParam {}
18
19 struct MyStruct;
20
21 impl WithAssoc for MyStruct {
22     type AssocType = MyParam;
23 }
24
25 fn my_fun<A>() -> Return<A> {
26     MyStruct
27 }
28
29 fn my_other_fn<A>() -> impl WithAssoc<AssocType = impl WithParam<A>> {
30     MyStruct
31 }
32
33 fn main() {}