summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs
blob: b9881defac39a180a30198d43d7445c763315e5f (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
// run-pass

#![allow(incomplete_features)]
#![feature(unsized_locals)]

pub trait Foo {
    fn foo(self) -> String;
}

struct A;

impl Foo for A {
    fn foo(self) -> String {
        format!("hello")
    }
}

fn main() {
    let x = *(Box::new(A) as Box<dyn Foo>);
    assert_eq!(x.foo(), format!("hello"));

    // I'm not sure whether we want this to work
    let x = Box::new(A) as Box<dyn Foo>;
    assert_eq!(x.foo(), format!("hello"));
}