summaryrefslogtreecommitdiffstats
path: root/src/test/ui/specialization/default-associated-type-bound-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/specialization/default-associated-type-bound-2.rs')
-rw-r--r--src/test/ui/specialization/default-associated-type-bound-2.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/specialization/default-associated-type-bound-2.rs b/src/test/ui/specialization/default-associated-type-bound-2.rs
new file mode 100644
index 000000000..0a21b1f09
--- /dev/null
+++ b/src/test/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);
+}