17 lines
370 B
Rust
17 lines
370 B
Rust
|
// 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;
|
||
|
let ctr = lambda() -> int {
|
||
|
block() { i = i + 1; }();
|
||
|
ret i;
|
||
|
};
|
||
|
log_err ctr();
|
||
|
log_err ctr();
|
||
|
log_err ctr();
|
||
|
log_err ctr();
|
||
|
log_err ctr();
|
||
|
log_err i;
|
||
|
}
|