diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-03-29 01:01:32 +0100 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2020-03-30 19:44:21 +0200 |
| commit | 103771ce57acc240bc01abf4f7365172935bc7fb (patch) | |
| tree | 038bde36276477bd1b739d92066e2a680d914e03 | |
| parent | 49ba323c8db6fd5fbe3d72f623c9d89cb09c508d (diff) | |
| download | rust-103771ce57acc240bc01abf4f7365172935bc7fb.tar.gz rust-103771ce57acc240bc01abf4f7365172935bc7fb.zip | |
Add a test
| -rw-r--r-- | src/test/ui/specialization/issue-70442.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/specialization/issue-70442.rs b/src/test/ui/specialization/issue-70442.rs new file mode 100644 index 00000000000..4371dd2e167 --- /dev/null +++ b/src/test/ui/specialization/issue-70442.rs @@ -0,0 +1,23 @@ +#![feature(specialization)] + +// check-pass + +trait Trait { + type Assoc; +} + +impl<T> Trait for T { + default type Assoc = bool; +} + +// This impl inherits the `Assoc` definition from above and "locks it in", or finalizes it, making +// child impls unable to further specialize it. However, since the specialization graph didn't +// correctly track this, we would refuse to project `Assoc` from this impl, even though that should +// happen for items that are final. +impl Trait for () {} + +fn foo<X: Trait<Assoc=bool>>() {} + +fn main() { + foo::<()>(); // `<() as Trait>::Assoc` is normalized to `bool` correctly +} |
