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