]> git.proxmox.com Git - rustc.git/blob - tests/ui/fn/fn-closure-mutable-capture.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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 //~| NOTE in this closure
10 }
11
12 fn main() {}