rust/tests/ui/traits/wf-object/maybe-bound.rs

19 lines
544 B
Rust
Raw Normal View History

2019-05-01 20:21:20 -05:00
// Test that `dyn ... + ?Sized + ...` is okay (though `?Sized` has no effect in trait objects).
2019-03-30 17:06:09 -05:00
2019-05-01 20:21:20 -05:00
trait Foo {}
2019-03-30 17:06:09 -05:00
2019-05-01 20:21:20 -05:00
type _0 = dyn ?Sized + Foo;
//~^ ERROR `?Trait` is not permitted in trait object types
2019-03-30 17:06:09 -05:00
2019-05-01 20:21:20 -05:00
type _1 = dyn Foo + ?Sized;
//~^ ERROR `?Trait` is not permitted in trait object types
2019-05-01 20:21:20 -05:00
type _2 = dyn Foo + ?Sized + ?Sized;
//~^ ERROR `?Trait` is not permitted in trait object types
//~| ERROR `?Trait` is not permitted in trait object types
2019-05-01 20:21:20 -05:00
type _3 = dyn ?Sized + Foo;
//~^ ERROR `?Trait` is not permitted in trait object types
2019-03-30 17:06:09 -05:00
fn main() {}