mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +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;
|
|
}
|