1 error[E0382]: use of moved value: `f`
2 --> $DIR/borrow-closures-instead-of-move.rs:3:22
4 LL | fn takes_fn(f: impl Fn()) {
5 | - move occurs because `f` has type `impl Fn()`, which does not implement the `Copy` trait
7 | ---- inside of this loop
9 | ^ value moved here, in previous iteration of loop
11 note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary
12 --> $DIR/borrow-closures-instead-of-move.rs:34:20
14 LL | fn takes_fnonce(_: impl FnOnce()) {}
15 | ------------ ^^^^^^^^^^^^^ this parameter takes ownership of the value
18 help: consider borrowing `f`
20 LL | takes_fnonce(&f);
23 error[E0382]: use of moved value: `m`
24 --> $DIR/borrow-closures-instead-of-move.rs:14:18
26 LL | fn takes_fn_mut(m: impl FnMut()) {
27 | - move occurs because `m` has type `impl FnMut()`, which does not implement the `Copy` trait
33 | ^ value used here after move
35 note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary
36 --> $DIR/borrow-closures-instead-of-move.rs:34:20
38 LL | fn takes_fnonce(_: impl FnOnce()) {}
39 | ------------ ^^^^^^^^^^^^^ this parameter takes ownership of the value
42 help: consider mutably borrowing `m`
44 LL | takes_fnonce(&mut m);
47 error[E0382]: borrow of moved value: `closure`
48 --> $DIR/borrow-closures-instead-of-move.rs:25:5
50 LL | takes_fnonce(closure);
51 | ------- value moved here
54 | ^^^^^^^ value borrowed here after move
56 note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `x` out of its environment
57 --> $DIR/borrow-closures-instead-of-move.rs:21:9
61 help: consider mutably borrowing `closure`
63 LL | takes_fnonce(&mut closure);
66 error: aborting due to 3 previous errors
68 For more information about this error, try `rustc --explain E0382`.