]> git.lizzy.rs Git - rust.git/blob - src/test/ui/fn/fn-closure-mutable-capture.rs
Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyup
[rust.git] / src / test / ui / fn / fn-closure-mutable-capture.rs
1 pub fn bar<F: Fn()>(_f: F) {} //~ NOTE change this to accept `FnMut` instead of `Fn`
2
3 pub fn foo() {
4     let mut x = 0;
5     bar(move || x = 1);
6     //~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
7     //~| NOTE cannot assign
8     //~| NOTE expects `Fn` instead of `FnMut`
9 }
10
11 fn main() {}