2014-11-14 17:14:52 -06:00
|
|
|
struct Test {
|
|
|
|
a: isize,
|
|
|
|
b: Option<Box<Test>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for Test {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
println!("Dropping {}", self.a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn stuff() {
|
|
|
|
let mut t = Test { a: 1, b: None};
|
|
|
|
let mut u = Test { a: 2, b: Some(Box::new(t))};
|
|
|
|
t.b = Some(Box::new(u));
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR assign of moved value: `t`
|
2014-11-14 17:14:52 -06:00
|
|
|
println!("done");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
stuff();
|
|
|
|
println!("Hello, world!")
|
|
|
|
}
|