]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized-locals/by-value-trait-object-safety.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / unsized-locals / by-value-trait-object-safety.rs
1 #![feature(unsized_locals)]
2 //~^ WARN the feature `unsized_locals` is incomplete
3
4 pub trait Foo {
5     fn foo(self) -> String
6     where
7         Self: Sized;
8 }
9
10 struct A;
11
12 impl Foo for A {
13     fn foo(self) -> String {
14         format!("hello")
15     }
16 }
17
18 fn main() {
19     let x = *(Box::new(A) as Box<dyn Foo>);
20     x.foo();
21     //~^ERROR the `foo` method cannot be invoked on a trait object
22 }