2014-10-03 00:57:21 -07:00
|
|
|
// Test that an unboxed closure that mutates a free variable will
|
|
|
|
// cause borrow conflicts.
|
|
|
|
|
2018-08-15 23:39:30 +02:00
|
|
|
|
|
|
|
|
2014-10-03 00:57:21 -07:00
|
|
|
fn main() {
|
2015-03-03 10:42:26 +02:00
|
|
|
let mut x = 0;
|
2015-02-01 12:44:15 -05:00
|
|
|
let f = || x += 1;
|
2014-10-03 00:57:21 -07:00
|
|
|
let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
|
2018-08-15 23:39:30 +02:00
|
|
|
f;
|
2014-10-03 00:57:21 -07:00
|
|
|
}
|