Closed
Description
This program works as expected:
fn main() {
let a = |x:int| { |y:int| -> int { x + y } };
let b = a(2);
//println(int::to_str(a(2)(3)));
println(int::to_str(b(3))); // 6
}
Uncomment that line and something goofy happens:
fn main() {
let a = |x:int| { |y:int| -> int { x + y } };
let b = a(2);
println(int::to_str(a(2)(3))); // 6
println(int::to_str(b(3))); // completely random number
}
The second print will be a different number every time it is run. This feels quite dangerous.
And if you try to use error!(b(3))
, even in the first program, you get a segfault. But that might be a separate bug.
Metadata
Metadata
Assignees
Labels
Area: Lifetimes / regionsArea: Type systemCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.