summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr
blob: 7782047574ce8e7b6b8ba9b6180c280fdf66d8bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
  --> $DIR/mut-borrow-of-mut-ref.rs:7:7
   |
LL |     h(&mut b);
   |       ^^^^^^ cannot borrow as mutable
   |
note: the binding is already a mutable borrow
  --> $DIR/mut-borrow-of-mut-ref.rs:4:13
   |
LL | pub fn f(b: &mut i32) {
   |             ^^^^^^^^
help: try removing `&mut` here
   |
LL -     h(&mut b);
LL +     h(b);
   |

error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
  --> $DIR/mut-borrow-of-mut-ref.rs:11:12
   |
LL |     g(&mut &mut b);
   |            ^^^^^^ cannot borrow as mutable
   |
note: the binding is already a mutable borrow
  --> $DIR/mut-borrow-of-mut-ref.rs:4:13
   |
LL | pub fn f(b: &mut i32) {
   |             ^^^^^^^^
help: try removing `&mut` here
   |
LL -     g(&mut &mut b);
LL +     g(&mut b);
   |

error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
  --> $DIR/mut-borrow-of-mut-ref.rs:18:12
   |
LL |     h(&mut &mut b);
   |            ^^^^^^ cannot borrow as mutable
   |
note: the binding is already a mutable borrow
  --> $DIR/mut-borrow-of-mut-ref.rs:17:13
   |
LL | pub fn g(b: &mut i32) {
   |             ^^^^^^^^
help: try removing `&mut` here
   |
LL -     h(&mut &mut b);
LL +     h(&mut b);
   |

error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
  --> $DIR/mut-borrow-of-mut-ref.rs:35:5
   |
LL |     f.bar();
   |     ^^^^^^^ cannot borrow as mutable
   |
help: consider making the binding mutable
   |
LL | pub fn baz(mut f: &mut String) {
   |            +++

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0596`.