Closed
Description
struct X {
x: ~str;
drop {
error!("destructing wrapper");
error!("value: %s", self.x);
}
}
fn foo(+x: X) -> ~str {
let X { x: y } = x;
error!("unwrapped it");
y
}
fn main() {
let x = X { x: ~"hello" };
let y = foo(x);
error!("got inner");
error!("contents: %s", y);
}
prints:
rust: ~"unwrapped it"
rust: ~"destructing wrapper"
Segmentation fault (core dumped)
Metadata
Metadata
Assignees
Labels
No labels