fork/rust

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

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

1.44.0
1.6 KiB35 linesraw
1error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2  --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25
3   |
4LL | fn deref_mut1(x: Own<isize>) {
5   |               - help: consider changing this to be mutable: `mut x`
6LL |     let __isize = &mut *x;
7   |                         ^ cannot borrow as mutable
8
9error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
10  --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11
11   |
12LL | fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize {
13   |                             -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
14LL |     &mut **x
15   |           ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
16
17error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
18  --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6
19   |
20LL | fn assign1<'a>(x: Own<isize>) {
21   |                - help: consider changing this to be mutable: `mut x`
22LL |     *x = 3;
23   |      ^ cannot borrow as mutable
24
25error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
26  --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6
27   |
28LL | fn assign2<'a>(x: &'a Own<isize>) {
29   |                   -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
30LL |     **x = 3;
31   |      ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
32
33error: aborting due to 4 previous errors
34
35For more information about this error, try `rustc --explain E0596`.