]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / two-phase-nonrecv-autoref.base.stderr
1 error[E0499]: cannot borrow `*f` as mutable more than once at a time
2   --> $DIR/two-phase-nonrecv-autoref.rs:50:11
3    |
4 LL |         f(f(10));
5    |         - ^ second mutable borrow occurs here
6    |         |
7    |         first mutable borrow occurs here
8    |         first borrow later used by call
9
10 error[E0382]: use of moved value: `f`
11   --> $DIR/two-phase-nonrecv-autoref.rs:57:11
12    |
13 LL |     fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
14    |                                            - move occurs because `f` has type `Box<F>`, which does not implement the `Copy` trait
15 LL |         f(f(10));
16    |         - ^ value used here after move
17    |         |
18    |         value moved here
19
20 error[E0499]: cannot borrow `*f` as mutable more than once at a time
21   --> $DIR/two-phase-nonrecv-autoref.rs:62:11
22    |
23 LL |         f(f(10));
24    |         - ^ second mutable borrow occurs here
25    |         |
26    |         first mutable borrow occurs here
27    |         first borrow later used by call
28
29 error[E0382]: use of moved value: `f`
30   --> $DIR/two-phase-nonrecv-autoref.rs:69:11
31    |
32 LL |     fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
33    |                     - move occurs because `f` has type `Box<dyn FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
34 LL |         f(f(10));
35    |         - ^ value used here after move
36    |         |
37    |         value moved here
38
39 error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
40   --> $DIR/two-phase-nonrecv-autoref.rs:107:27
41    |
42 LL |     double_access(&mut a, &a);
43    |     ------------- ------  ^^ immutable borrow occurs here
44    |     |             |
45    |     |             mutable borrow occurs here
46    |     mutable borrow later used by call
47
48 error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
49   --> $DIR/two-phase-nonrecv-autoref.rs:132:7
50    |
51 LL |     i[i[3]] = 4;
52    |     --^----
53    |     | |
54    |     | immutable borrow occurs here
55    |     mutable borrow occurs here
56    |     mutable borrow later used here
57    |
58 help: try adding a local storing this...
59   --> $DIR/two-phase-nonrecv-autoref.rs:132:7
60    |
61 LL |     i[i[3]] = 4;
62    |       ^^^^
63 help: ...and then using that local here
64   --> $DIR/two-phase-nonrecv-autoref.rs:132:5
65    |
66 LL |     i[i[3]] = 4;
67    |     ^^^^^^^
68
69 error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
70   --> $DIR/two-phase-nonrecv-autoref.rs:138:7
71    |
72 LL |     i[i[3]] = i[4];
73    |     --^----
74    |     | |
75    |     | immutable borrow occurs here
76    |     mutable borrow occurs here
77    |     mutable borrow later used here
78    |
79 help: try adding a local storing this...
80   --> $DIR/two-phase-nonrecv-autoref.rs:138:7
81    |
82 LL |     i[i[3]] = i[4];
83    |       ^^^^
84 help: ...and then using that local here
85   --> $DIR/two-phase-nonrecv-autoref.rs:138:5
86    |
87 LL |     i[i[3]] = i[4];
88    |     ^^^^^^^
89
90 error: aborting due to 7 previous errors
91
92 Some errors have detailed explanations: E0382, E0499, E0502.
93 For more information about an error, try `rustc --explain E0382`.