about summary refs log tree commit diff
path: root/tests/ui/sized-hierarchy/pointee-supertrait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/sized-hierarchy/pointee-supertrait.rs')
-rw-r--r--tests/ui/sized-hierarchy/pointee-supertrait.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/sized-hierarchy/pointee-supertrait.rs b/tests/ui/sized-hierarchy/pointee-supertrait.rs
new file mode 100644
index 00000000000..4bf486890bf
--- /dev/null
+++ b/tests/ui/sized-hierarchy/pointee-supertrait.rs
@@ -0,0 +1,28 @@
+//@ check-pass
+#![feature(sized_hierarchy)]
+
+// This is a reduction of some code in `library/core/src/cmp.rs` that would ICE if a default
+// `Pointee` bound is added - motivating the current status quo of `PointeeSized` being syntactic
+// sugar for an absense of any bounds whatsoever.
+
+use std::marker::PhantomData;
+
+pub trait Bar<'a> {
+    type Foo;
+}
+
+pub struct Foo<'a, T: Bar<'a>> {
+    phantom: PhantomData<&'a T>,
+}
+
+impl<'a, 'b, T> PartialEq<Foo<'b, T>> for Foo<'a, T>
+    where
+        T: for<'c> Bar<'c>,
+        <T as Bar<'a>>::Foo: PartialEq<<T as Bar<'b>>::Foo>,
+{
+    fn eq(&self, _: &Foo<'b, T>) -> bool {
+        loop {}
+    }
+}
+
+fn main() { }