2011-09-01 07:35:00 -05:00
|
|
|
// error-pattern:assigning to upvar
|
2011-08-04 21:31:47 -05:00
|
|
|
// Make sure we can't write to upvars from lambdas
|
|
|
|
fn main() {
|
|
|
|
let i = 0;
|
2011-08-19 17:16:48 -05:00
|
|
|
let ctr = lambda () -> int { i = i + 1; ret i; };
|
2011-12-22 19:53:53 -06:00
|
|
|
log(error, ctr());
|
|
|
|
log(error, ctr());
|
|
|
|
log(error, ctr());
|
|
|
|
log(error, ctr());
|
|
|
|
log(error, ctr());
|
|
|
|
log(error, i);
|
2011-08-04 21:31:47 -05:00
|
|
|
}
|