]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/issue-31597.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / associated-types / issue-31597.rs
1 // check-pass
2 #![allow(dead_code)]
3 trait Make {
4     type Out;
5
6     fn make() -> Self::Out;
7 }
8
9 impl Make for () {
10     type Out = ();
11
12     fn make() -> Self::Out {}
13 }
14
15 // Also make sure we don't hit an ICE when the projection can't be known
16 fn f<T: Make>() -> <T as Make>::Out { loop {} }
17
18 // ...and that it works with a blanket impl
19 trait Tr {
20     type Assoc;
21 }
22
23 impl<T: Make> Tr for T {
24     type Assoc = ();
25 }
26
27 fn g<T: Make>() -> <T as Tr>::Assoc { }
28
29 fn main() {}