]> git.proxmox.com Git - rustc.git/blob - src/test/ui/unique-object-noncopyable.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / unique-object-noncopyable.rs
1 #![feature(box_syntax)]
2
3 trait Foo {
4 fn f(&self);
5 }
6
7 struct Bar {
8 x: isize,
9 }
10
11 impl Drop for Bar {
12 fn drop(&mut self) {}
13 }
14
15 impl Foo for Bar {
16 fn f(&self) {
17 println!("hi");
18 }
19 }
20
21 fn main() {
22 let x = box Bar { x: 10 };
23 let y: Box<dyn Foo> = x as Box<dyn Foo>;
24 let _z = y.clone(); //~ ERROR the method
25 }