mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
11 lines
273 B
Rust
11 lines
273 B
Rust
// Test that closures cannot subvert aliasing restrictions
|
|
|
|
fn main() {
|
|
// Unboxed closure case
|
|
{
|
|
let mut x = 0;
|
|
let mut f = || &mut x; //~ ERROR captured variable cannot escape `FnMut` closure body
|
|
let x = f();
|
|
let y = f();
|
|
}
|
|
}
|