fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
2.5 KiB71 linesraw
1error[E0499]: cannot borrow `*f` as mutable more than once at a time
2  --> $DIR/two-phase-nonrecv-autoref.rs:51:11
3   |
4LL |         f(f(10));
5   |         - ^ second mutable borrow occurs here
6   |         |
7   |         first mutable borrow occurs here
8   |         first borrow later used by call
9
10error[E0382]: use of moved value: `f`
11  --> $DIR/two-phase-nonrecv-autoref.rs:59:11
12   |
13LL |     fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
14   |                                            - move occurs because `f` has type `std::boxed::Box<F>`, which does not implement the `Copy` trait
15LL |         f(f(10));
16   |         - ^ value used here after move
17   |         |
18   |         value moved here
19
20error[E0499]: cannot borrow `*f` as mutable more than once at a time
21  --> $DIR/two-phase-nonrecv-autoref.rs:65:11
22   |
23LL |         f(f(10));
24   |         - ^ second mutable borrow occurs here
25   |         |
26   |         first mutable borrow occurs here
27   |         first borrow later used by call
28
29error[E0382]: use of moved value: `f`
30  --> $DIR/two-phase-nonrecv-autoref.rs:73:11
31   |
32LL |     fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
33   |                     - move occurs because `f` has type `std::boxed::Box<dyn std::ops::FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
34LL |         f(f(10));
35   |         - ^ value used here after move
36   |         |
37   |         value moved here
38
39error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
40  --> $DIR/two-phase-nonrecv-autoref.rs:112:27
41   |
42LL |     double_access(&mut a, &a);
43   |     ------------- ------  ^^ immutable borrow occurs here
44   |     |             |
45   |     |             mutable borrow occurs here
46   |     mutable borrow later used by call
47
48error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
49  --> $DIR/two-phase-nonrecv-autoref.rs:138:7
50   |
51LL |     i[i[3]] = 4;
52   |     --^----
53   |     | |
54   |     | immutable borrow occurs here
55   |     mutable borrow occurs here
56   |     mutable borrow later used here
57
58error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
59  --> $DIR/two-phase-nonrecv-autoref.rs:143:7
60   |
61LL |     i[i[3]] = i[4];
62   |     --^----
63   |     | |
64   |     | immutable borrow occurs here
65   |     mutable borrow occurs here
66   |     mutable borrow later used here
67
68error: aborting due to 7 previous errors
69
70Some errors have detailed explanations: E0382, E0499, E0502.
71For more information about an error, try `rustc --explain E0382`.