-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Milestone
Description
Example:
fn main() {
let mut x = Some(~1);
let mut p: proc(&mut Option<~int>) = proc(_) {};
match x {
Some(ref y) => {
p = proc(z: &mut Option<~int>) {
*z = None;
println!("{}", y);
}
}
None => {}
}
p(&mut x);
}The last statement p(&mut x) is mutably borrowing x but x is already borrowed (or rather should be) by the proc.
The result is a program that compiles fine but segfaults when run.
Metadata
Metadata
Assignees
Labels
No labels