]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
Auto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomez
[rust.git] / tests / 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 }