diff options
Diffstat (limited to 'tests/ui/specialization/default-associated-type-bound-2.rs')
-rw-r--r-- | tests/ui/specialization/default-associated-type-bound-2.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/specialization/default-associated-type-bound-2.rs b/tests/ui/specialization/default-associated-type-bound-2.rs new file mode 100644 index 000000000..0a21b1f09 --- /dev/null +++ b/tests/ui/specialization/default-associated-type-bound-2.rs @@ -0,0 +1,22 @@ +// Check that generic predicates are also checked for default associated types. +#![feature(specialization)] +//~^ WARNING `specialization` is incomplete + +trait X<T> { + type U: PartialEq<T>; + fn unsafe_compare(x: Option<Self::U>, y: Option<T>) { + match (x, y) { + (Some(a), Some(b)) => a == b, + _ => false, + }; + } +} + +impl<B: 'static, T> X<B> for T { + default type U = &'static B; + //~^ ERROR can't compare `&'static B` with `B` +} + +pub fn main() { + <i32 as X<i32>>::unsafe_compare(None, None); +} |