]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs
Rollup merge of #105843 - compiler-errors:sugg-const, r=lcnr
[rust.git] / src / test / ui / unboxed-closures / unboxed-closures-mutated-upvar-from-fn-closure.rs
1 // Test that a by-ref `FnMut` closure gets an error when it tries to
2 // mutate a value.
3
4 fn call<F>(f: F) where F : Fn() {
5     f();
6 }
7
8 fn main() {
9     let mut counter = 0;
10     call(|| {
11         counter += 1;
12         //~^ ERROR cannot assign to `counter`
13     });
14 }