mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
26 lines
446 B
Rust
26 lines
446 B
Rust
// 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"));
|
|
}
|