]> git.proxmox.com Git - rustc.git/blob - tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / type-alias-impl-trait / issue-76202-trait-impl-for-tait.rs
1 // Regression test for issue #76202
2 // Tests that we don't ICE when we have a trait impl on a TAIT.
3
4 // check-pass
5
6 #![feature(type_alias_impl_trait)]
7
8 trait Dummy {}
9 impl Dummy for () {}
10
11 type F = impl Dummy;
12 fn f() -> F {}
13
14 trait Test {
15 fn test(self);
16 }
17
18 impl Test for F {
19 fn test(self) {}
20 }
21
22 // Ok because `i32` does not implement `Dummy`,
23 // so it can't possibly be the hidden type of `F`.
24 impl Test for i32 {
25 fn test(self) {}
26 }
27
28 fn main() {
29 let x: F = f();
30 x.test();
31 }