//@ compile-flags: --crate-type=lib #![feature(sized_hierarchy)] use std::marker::{MetaSized, PointeeSized}; pub trait Tr: PointeeSized {} impl Tr for u32 {} pub fn sized() -> Box { if true { let x = sized(); let y: Box = x; } Box::new(1u32) } pub fn neg_sized() -> Box { if true { let x = neg_sized(); let y: Box = x; //~^ ERROR: the size for values of type `impl Tr + MetaSized` cannot be known } Box::new(1u32) } pub fn metasized() -> Box { if true { let x = metasized(); let y: Box = x; //~^ ERROR: the size for values of type `impl Tr + MetaSized` cannot be known } Box::new(1u32) } pub fn pointeesized() -> Box { //~^ ERROR: the size for values of type `impl Tr + PointeeSized` cannot be known if true { let x = pointeesized(); //~^ ERROR: the size for values of type `impl Tr + PointeeSized` cannot be known let y: Box = x; //~^ ERROR: the size for values of type `impl Tr + PointeeSized` cannot be known //~| ERROR: the size for values of type `impl Tr + PointeeSized` cannot be known } Box::new(1u32) }