]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/borrowck-partial-reinit-2.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / borrowck / borrowck-partial-reinit-2.rs
1 struct Test {
2 a: isize,
3 b: Option<Box<Test>>,
4 }
5
6 impl Drop for Test {
7 fn drop(&mut self) {
8 println!("Dropping {}", self.a);
9 }
10 }
11
12 fn stuff() {
13 let mut t = Test { a: 1, b: None};
14 let mut u = Test { a: 2, b: Some(Box::new(t))};
15 t.b = Some(Box::new(u));
16 //~^ ERROR assign of moved value: `t`
17 println!("done");
18 }
19
20 fn main() {
21 stuff();
22 println!("Hello, world!")
23 }