mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
24 lines
541 B
Rust
24 lines
541 B
Rust
//! 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
|
|
//@[next] check-pass
|
|
|
|
#![feature(trait_upcasting)]
|
|
|
|
trait Trait {}
|
|
|
|
impl Trait for u32 {}
|
|
|
|
fn hello() -> Box<impl Trait + ?Sized> {
|
|
if true {
|
|
let x = hello();
|
|
let y: Box<dyn Send> = x as Box<dyn Trait + Send>;
|
|
//[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
|
|
}
|
|
Box::new(1u32)
|
|
}
|
|
|
|
fn main() {}
|