]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr
Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb
[rust.git] / src / test / ui / span / borrowck-borrow-overloaded-deref-mut.stderr
1 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2   --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25
3    |
4 LL | fn deref_mut1(x: Own<isize>) {
5    |               - help: consider changing this to be mutable: `mut x`
6 LL |     let __isize = &mut *x;
7    |                         ^ cannot borrow as mutable
8
9 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
10   --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11
11    |
12 LL | 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>`
14 LL |     &mut **x
15    |           ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
16
17 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
18   --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6
19    |
20 LL | fn assign1<'a>(x: Own<isize>) {
21    |                - help: consider changing this to be mutable: `mut x`
22 LL |     *x = 3;
23    |      ^ cannot borrow as mutable
24
25 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
26   --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6
27    |
28 LL | fn assign2<'a>(x: &'a Own<isize>) {
29    |                   -------------- help: consider changing this to be a mutable reference: `&'a mut Own<isize>`
30 LL |     **x = 3;
31    |      ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
32
33 error: aborting due to 4 previous errors
34
35 For more information about this error, try `rustc --explain E0596`.