]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
Sync rust-lang/portable-simd@5f49d4c8435a25d804b2f375e949cb25479f5be9
[rust.git] / src / test / ui / unboxed-closures / unboxed-closures-borrow-conflict.rs
1 // Test that an unboxed closure that mutates a free variable will
2 // cause borrow conflicts.
3
4
5
6 fn main() {
7     let mut x = 0;
8     let f = || x += 1;
9     let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
10     f;
11 }