about summary refs log tree commit diff
path: root/tests/ui/impl-trait/unsized_coercion4.rs
blob: 1c4d5462ceeb29f5f45bc563193e595d5ec654dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! 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
//@check-pass

trait Trait {}

impl Trait for u32 {}

fn hello() -> Box<impl Trait + ?Sized> {
    if true {
        let x = hello() as Box<u32>;
        let y: Box<dyn Send> = x;
    }
    Box::new(1u32)
}

fn main() {}