summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/wf-object/maybe-bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/traits/wf-object/maybe-bound.rs')
-rw-r--r--src/test/ui/traits/wf-object/maybe-bound.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/traits/wf-object/maybe-bound.rs b/src/test/ui/traits/wf-object/maybe-bound.rs
new file mode 100644
index 000000000..17771e976
--- /dev/null
+++ b/src/test/ui/traits/wf-object/maybe-bound.rs
@@ -0,0 +1,18 @@
+// Test that `dyn ... + ?Sized + ...` is okay (though `?Sized` has no effect in trait objects).
+
+trait Foo {}
+
+type _0 = dyn ?Sized + Foo;
+//~^ ERROR `?Trait` is not permitted in trait object types
+
+type _1 = dyn Foo + ?Sized;
+//~^ ERROR `?Trait` is not permitted in trait object types
+
+type _2 = dyn Foo + ?Sized + ?Sized;
+//~^ ERROR `?Trait` is not permitted in trait object types
+//~| ERROR `?Trait` is not permitted in trait object types
+
+type _3 = dyn ?Sized + Foo;
+//~^ ERROR `?Trait` is not permitted in trait object types
+
+fn main() {}