]> git.proxmox.com Git - rustc.git/blob - src/test/ui/specialization/issue-70442.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / specialization / issue-70442.rs
1 #![feature(specialization)] //~ WARN the feature `specialization` is incomplete
2
3 // check-pass
4
5 trait Trait {
6 type Assoc;
7 }
8
9 impl<T> Trait for T {
10 default type Assoc = bool;
11 }
12
13 // This impl inherits the `Assoc` definition from above and "locks it in", or finalizes it, making
14 // child impls unable to further specialize it. However, since the specialization graph didn't
15 // correctly track this, we would refuse to project `Assoc` from this impl, even though that should
16 // happen for items that are final.
17 impl Trait for () {}
18
19 fn foo<X: Trait<Assoc=bool>>() {}
20
21 fn main() {
22 foo::<()>(); // `<() as Trait>::Assoc` is normalized to `bool` correctly
23 }