2014-10-08 00:08:30 -07:00
|
|
|
// Test that closures cannot subvert aliasing restrictions
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Unboxed closure case
|
|
|
|
{
|
2015-03-03 10:42:26 +02:00
|
|
|
let mut x = 0;
|
2020-05-20 18:58:41 +01:00
|
|
|
let mut f = || &mut x; //~ ERROR captured variable cannot escape `FnMut` closure body
|
2014-10-08 00:08:30 -07:00
|
|
|
let x = f();
|
|
|
|
let y = f();
|
|
|
|
}
|
|
|
|
}
|