summaryrefslogtreecommitdiffstats
path: root/src/test/ui/object-safety/object-safety-bounds.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/object-safety/object-safety-bounds.rs')
-rw-r--r--src/test/ui/object-safety/object-safety-bounds.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/object-safety/object-safety-bounds.rs b/src/test/ui/object-safety/object-safety-bounds.rs
new file mode 100644
index 000000000..44bd36932
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-bounds.rs
@@ -0,0 +1,12 @@
+// Traits with bounds mentioning `Self` are not object safe
+
+trait X {
+ type U: PartialEq<Self>;
+}
+
+fn f() -> Box<dyn X<U = u32>> {
+ //~^ ERROR the trait `X` cannot be made into an object
+ loop {}
+}
+
+fn main() {}