]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-unboxed-closures.stderr
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / borrowck-unboxed-closures.stderr
1 error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
2   --> $DIR/borrowck-unboxed-closures.rs:3:5
3    |
4 LL |     let g = &mut f;
5    |             ------ mutable borrow occurs here
6 LL |     f(1, 2);
7    |     ^ immutable borrow occurs here
8 LL |     use_mut(g);
9    |             - mutable borrow later used here
10
11 error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
12   --> $DIR/borrowck-unboxed-closures.rs:7:5
13    |
14 LL |     f(1, 2);
15    |     ^ cannot borrow as mutable
16    |
17 help: consider changing this to be mutable
18    |
19 LL | fn b<F:FnMut(isize, isize) -> isize>(mut f: F) {
20    |                                      +++
21
22 error[E0382]: use of moved value: `f`
23   --> $DIR/borrowck-unboxed-closures.rs:12:5
24    |
25 LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
26    |                                       - move occurs because `f` has type `F`, which does not implement the `Copy` trait
27 LL |     f(1, 2);
28    |     ------- `f` moved due to this call
29 LL |     f(1, 2);
30    |     ^ value used here after move
31    |
32 note: this value implements `FnOnce`, which causes it to be moved when called
33   --> $DIR/borrowck-unboxed-closures.rs:11:5
34    |
35 LL |     f(1, 2);
36    |     ^
37 help: consider further restricting this bound
38    |
39 LL | fn c<F:FnOnce(isize, isize) -> isize + Copy>(f: F) {
40    |                                      ++++++
41
42 error: aborting due to 3 previous errors
43
44 Some errors have detailed explanations: E0382, E0502, E0596.
45 For more information about an error, try `rustc --explain E0382`.