diff options
Diffstat (limited to 'tests/ui/traits/wf-object/maybe-bound.rs')
-rw-r--r-- | tests/ui/traits/wf-object/maybe-bound.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/traits/wf-object/maybe-bound.rs b/tests/ui/traits/wf-object/maybe-bound.rs new file mode 100644 index 000000000..17771e976 --- /dev/null +++ b/tests/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() {} |