mirror of
https://git.proxmox.com/git/rustc
synced 2025-05-04 21:46:16 +00:00
22 lines
258 B
Rust
22 lines
258 B
Rust
// run-pass
|
|
|
|
trait Foo {
|
|
fn f(self: Box<Self>);
|
|
}
|
|
|
|
struct S {
|
|
x: isize
|
|
}
|
|
|
|
impl Foo for S {
|
|
fn f(self: Box<S>) {
|
|
assert_eq!(self.x, 3);
|
|
}
|
|
}
|
|
|
|
pub fn main() {
|
|
let x = Box::new(S { x: 3 });
|
|
let y = x as Box<dyn Foo>;
|
|
y.f();
|
|
}
|