fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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