2022-05-21 18:34:03 +00:00
|
|
|
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:51:11
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | f(f(10));
|
|
|
|
| - ^ second mutable borrow occurs here
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
|
|
|
| first borrow later used by call
|
|
|
|
|
|
|
|
error[E0382]: use of moved value: `f`
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:58:11
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
|
|
|
|
| - move occurs because `f` has type `Box<F>`, which does not implement the `Copy` trait
|
|
|
|
LL | f(f(10));
|
|
|
|
| - ^ value used here after move
|
|
|
|
| |
|
|
|
|
| value moved here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:63:11
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | f(f(10));
|
|
|
|
| - ^ second mutable borrow occurs here
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
|
|
|
| first borrow later used by call
|
|
|
|
|
|
|
|
error[E0382]: use of moved value: `f`
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:70:11
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
|
|
|
|
| - move occurs because `f` has type `Box<dyn FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
|
|
|
|
LL | f(f(10));
|
|
|
|
| - ^ value used here after move
|
|
|
|
| |
|
|
|
|
| value moved here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:108:27
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | double_access(&mut a, &a);
|
|
|
|
| ------------- ------ ^^ immutable borrow occurs here
|
|
|
|
| | |
|
|
|
|
| | mutable borrow occurs here
|
|
|
|
| mutable borrow later used by call
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:133:7
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | i[i[3]] = 4;
|
|
|
|
| --^----
|
2023-08-03 19:43:17 +00:00
|
|
|
| |||
|
|
|
|
| ||immutable borrow occurs here
|
|
|
|
| |mutable borrow later used here
|
2022-05-21 18:34:03 +00:00
|
|
|
| mutable borrow occurs here
|
|
|
|
|
|
|
|
|
help: try adding a local storing this...
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:133:8
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | i[i[3]] = 4;
|
2023-08-03 19:43:17 +00:00
|
|
|
| ^^^
|
2022-05-21 18:34:03 +00:00
|
|
|
help: ...and then using that local here
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:133:6
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | i[i[3]] = 4;
|
2023-08-03 19:43:17 +00:00
|
|
|
| ^^^^^^
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:139:7
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | i[i[3]] = i[4];
|
|
|
|
| --^----
|
2023-08-03 19:43:17 +00:00
|
|
|
| |||
|
|
|
|
| ||immutable borrow occurs here
|
|
|
|
| |mutable borrow later used here
|
2022-05-21 18:34:03 +00:00
|
|
|
| mutable borrow occurs here
|
|
|
|
|
|
|
|
|
help: try adding a local storing this...
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:139:8
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | i[i[3]] = i[4];
|
2023-08-03 19:43:17 +00:00
|
|
|
| ^^^
|
2022-05-21 18:34:03 +00:00
|
|
|
help: ...and then using that local here
|
2024-05-04 08:58:31 +00:00
|
|
|
--> $DIR/two-phase-nonrecv-autoref.rs:139:6
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
|
LL | i[i[3]] = i[4];
|
2023-08-03 19:43:17 +00:00
|
|
|
| ^^^^^^
|
2022-05-21 18:34:03 +00:00
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
|
|
|
|
|
|
|
Some errors have detailed explanations: E0382, E0499, E0502.
|
|
|
|
For more information about an error, try `rustc --explain E0382`.
|