]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/mut-borrow-of-mut-ref.stderr
Rollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum
[rust.git] / tests / ui / borrowck / mut-borrow-of-mut-ref.stderr
1 error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
2   --> $DIR/mut-borrow-of-mut-ref.rs:4:10
3    |
4 LL | pub fn f(b: &mut i32) {
5    |          ^ not mutable
6 ...
7 LL |     h(&mut b);
8    |       ------ cannot borrow as mutable
9 ...
10 LL |     g(&mut &mut b);
11    |            ------ cannot borrow as mutable
12    |
13 note: the binding is already a mutable borrow
14   --> $DIR/mut-borrow-of-mut-ref.rs:4:13
15    |
16 LL | pub fn f(b: &mut i32) {
17    |             ^^^^^^^^
18 help: try removing `&mut` here
19    |
20 LL -     h(&mut b);
21 LL +     h(b);
22    |
23 help: try removing `&mut` here
24    |
25 LL -     g(&mut &mut b);
26 LL +     g(&mut b);
27    |
28
29 error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
30   --> $DIR/mut-borrow-of-mut-ref.rs:17:12
31    |
32 LL |     h(&mut &mut b);
33    |            ^^^^^^ cannot borrow as mutable
34    |
35 note: the binding is already a mutable borrow
36   --> $DIR/mut-borrow-of-mut-ref.rs:16:13
37    |
38 LL | pub fn g(b: &mut i32) {
39    |             ^^^^^^^^
40 help: try removing `&mut` here
41    |
42 LL -     h(&mut &mut b);
43 LL +     h(&mut b);
44    |
45
46 error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
47   --> $DIR/mut-borrow-of-mut-ref.rs:34:5
48    |
49 LL |     f.bar();
50    |     ^^^^^^^ cannot borrow as mutable
51    |
52 help: consider making the binding mutable
53    |
54 LL | pub fn baz(mut f: &mut String) {
55    |            +++
56
57 error: aborting due to 3 previous errors
58
59 For more information about this error, try `rustc --explain E0596`.