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