2011-08-04 21:31:47 -05:00
|
|
|
// error-pattern:assigning to immutable alias
|
|
|
|
// Make sure that nesting a block within a lambda doesn't let us
|
|
|
|
// mutate upvars from a lambda.
|
|
|
|
fn main() {
|
|
|
|
let i = 0;
|
2011-08-19 17:16:48 -05:00
|
|
|
let ctr = lambda () -> int { block () { i = i + 1; }(); ret i; };
|
2011-08-04 21:31:47 -05:00
|
|
|
log_err ctr();
|
|
|
|
log_err ctr();
|
|
|
|
log_err ctr();
|
|
|
|
log_err ctr();
|
|
|
|
log_err ctr();
|
|
|
|
log_err i;
|
|
|
|
}
|