rust/tests/ui/unique/unique-object-noncopyable.rs
jyn 01b75e20f2 Move some UI tests into subdirectories
to avoid going over the existing limit now that the ui-fulldeps tests have
been moved to ui.
2023-04-02 19:42:30 -04:00

26 lines
324 B
Rust

trait Foo {
fn f(&self);
}
struct Bar {
x: isize,
}
impl Drop for Bar {
fn drop(&mut self) {}
}
impl Foo for Bar {
fn f(&self) {
println!("hi");
}
}
fn main() {
let x = Box::new(Bar { x: 10 });
let y: Box<dyn Foo> = x as Box<dyn Foo>;
let _z = y.clone(); //~ ERROR the method
}