//! This test checks that opaque types get unsized instead of //! constraining their hidden type to a trait object. //@ revisions: next old //@[next] compile-flags: -Znext-solver #![feature(trait_upcasting)] trait Trait {} impl Trait for u32 {} fn hello() -> Box { if true { let x = hello(); let y: Box = x as Box; //[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know //~^^ ERROR: mismatched types } Box::new(1u32) } fn main() {}