]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized-locals/by-value-trait-object-safety-rpass.rs
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
[rust.git] / tests / ui / unsized-locals / by-value-trait-object-safety-rpass.rs
1 // run-pass
2
3 #![allow(incomplete_features)]
4 #![feature(unsized_locals)]
5
6 pub trait Foo {
7     fn foo(self) -> String;
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     assert_eq!(x.foo(), format!("hello"));
21
22     // I'm not sure whether we want this to work
23     let x = Box::new(A) as Box<dyn Foo>;
24     assert_eq!(x.foo(), format!("hello"));
25 }