]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/lambda-mutate-nested.rs
Remove proto_sugar and 'lambda' as keyword, commit to fn@.
[rust.git] / src / test / compile-fail / lambda-mutate-nested.rs
1 // error-pattern:assigning to upvar
2 // Make sure that nesting a block within a fn@ doesn't let us
3 // mutate upvars from a fn@.
4 fn f2(x: block()) { x(); }
5
6 fn main() {
7     let i = 0;
8     let ctr = fn@ () -> int { f2({|| i = i + 1; }); ret i; };
9     log(error, ctr());
10     log(error, ctr());
11     log(error, ctr());
12     log(error, ctr());
13     log(error, ctr());
14     log(error, i);
15 }