rust/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.rs
David Wood 118d4e62c3
middle: print {Meta,Pointee}Sized in opaques
When `sized_hierarchy` is enabled, rustc should print `MetaSized` or
`PointeeSized` instead of `?Sized` in opaques.
2025-06-16 23:04:34 +00:00

14 lines
284 B
Rust

//@ compile-flags: --crate-type=lib
pub trait Tr {}
impl Tr for u32 {}
pub fn foo() -> Box<impl Tr + ?Sized> {
if true {
let x = foo();
let y: Box<dyn Tr> = x;
//~^ ERROR: the size for values of type `impl Tr + ?Sized` cannot be known
}
Box::new(1u32)
}