2018-09-12 00:19:09 +09:00
|
|
|
#![feature(unsized_locals)]
|
2020-05-23 09:35:22 -03:00
|
|
|
//~^ WARN the feature `unsized_locals` is incomplete
|
2018-09-12 00:19:09 +09:00
|
|
|
|
|
|
|
pub trait Foo {
|
2020-10-16 19:37:54 -03:00
|
|
|
fn foo(self) -> String
|
|
|
|
where
|
|
|
|
Self: Sized;
|
2018-09-12 00:19:09 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
struct A;
|
|
|
|
|
|
|
|
impl Foo for A {
|
|
|
|
fn foo(self) -> String {
|
|
|
|
format!("hello")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = *(Box::new(A) as Box<dyn Foo>);
|
|
|
|
x.foo();
|
|
|
|
//~^ERROR the `foo` method cannot be invoked on a trait object
|
|
|
|
}
|