Skip to content

Commit 103771c

Browse files
Add a test
1 parent 49ba323 commit 103771c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![feature(specialization)]
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+
}

0 commit comments

Comments
 (0)