Add a test that lambdas can't deinitialize upvars

This commit is contained in:
Tim Chevalier 2011-09-01 16:30:11 -07:00
parent e824775d53
commit ec763bba9c

View File

@ -0,0 +1,8 @@
// error-pattern:assigning to upvar
fn force(f: &block() -> int) -> int { ret f(); }
fn main() {
let x = 5;
let f = lambda () -> int { let y = 6; x <- y; ret 7 };
assert (force(f) == 7);
log x;
}