2019-07-26 21:54:25 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
2020-10-16 22:37:54 +00:00
|
|
|
#![allow(incomplete_features)]
|
2020-10-16 20:46:59 +00:00
|
|
|
#![feature(unsized_locals, unsized_fn_params)]
|
2018-09-11 15:19:09 +00:00
|
|
|
|
|
|
|
pub trait Foo {
|
|
|
|
fn foo(self) -> String {
|
|
|
|
format!("hello")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct A;
|
|
|
|
|
|
|
|
impl Foo for A {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = *(Box::new(A) as Box<dyn Foo>);
|
|
|
|
assert_eq!(x.foo(), format!("hello"));
|
2018-10-24 14:18:15 +00: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-11 15:19:09 +00:00
|
|
|
}
|