summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/new-solver/unsize-good.rs
blob: 87ed9cfd10ae456e734d9ce8c4d575d9415086bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// compile-flags: -Ztrait-solver=next
// check-pass

#![feature(unsized_tuple_coercion)]

trait Foo {}

impl Foo for i32 {}

fn main() {
    // Unsizing via struct
    let _: Box<dyn Foo> = Box::new(1i32);

    // Slice unsizing
    let y = [1, 2, 3];
    let _: &[i32] = &y;

    // Tuple unsizing
    let hi = (1i32,);
    let _: &(dyn Foo,) = &hi;

    // Dropping auto traits
    let a: &(dyn Foo + Send) = &1;
    let _: &dyn Foo = a;
}