//@ check-fail #![feature(sized_hierarchy)] use std::marker::{MetaSized, PointeeSized}; trait Sized_: Sized { } trait NegSized: ?Sized { } //~^ ERROR relaxed bounds are not permitted in supertrait bounds trait MetaSized_: MetaSized { } trait NegMetaSized: ?MetaSized { } //~^ ERROR relaxed bounds are not permitted in supertrait bounds trait PointeeSized_: PointeeSized { } trait NegPointeeSized: ?PointeeSized { } //~^ ERROR relaxed bounds are not permitted in supertrait bounds trait Bare {} fn requires_sized() {} fn requires_metasized() {} fn requires_pointeesized() {} fn with_sized_supertrait() { requires_sized::(); requires_metasized::(); requires_pointeesized::(); } fn with_metasized_supertrait() { requires_sized::(); //~^ ERROR the size for values of type `T` cannot be known at compilation time requires_metasized::(); requires_pointeesized::(); } // It isn't really possible to write this one.. fn with_pointeesized_supertrait() { requires_sized::(); //~^ ERROR the size for values of type `T` cannot be known requires_metasized::(); //~^ ERROR the size for values of type `T` cannot be known requires_pointeesized::(); } // `T` won't inherit the `const MetaSized` implicit supertrait of `Bare`, so there is an error on // the bound, which is expected. fn with_bare_trait() { //~^ ERROR the size for values of type `T` cannot be known requires_sized::(); //~^ ERROR the size for values of type `T` cannot be known requires_metasized::(); //~^ ERROR the size for values of type `T` cannot be known requires_pointeesized::(); } fn main() { }