Closed
Description
With rust 0.6, the following code produces a segfault. Indeed, at the time of println, *y is no longer a managed pointer to a string, but an arbitrary value crafted by the closure.
enum A { B(@str), C(int) }
fn main() -> () {
let mut x = B(@"");
let f = || { x = C(0); };
match x {
B(ref y) => { f(); println(*y) },
C(*) => ()
}
}
Metadata
Metadata
Assignees
Labels
No labels