2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2020-10-16 19:37:54 -03:00
|
|
|
#![allow(incomplete_features)]
|
2018-09-12 00:19:09 +09:00
|
|
|
#![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"));
|
2018-10-24 23:18:15 +09:00
|
|
|
|
|
|
|
// 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"));
|
2018-09-12 00:19:09 +09:00
|
|
|
}
|