mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
12 lines
232 B
Rust
12 lines
232 B
Rust
// Test that an unboxed closure that mutates a free variable will
|
|
// cause borrow conflicts.
|
|
|
|
|
|
|
|
fn main() {
|
|
let mut x = 0;
|
|
let f = || x += 1;
|
|
let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
|
|
f;
|
|
}
|