2019-04-22 07:40:08 +00:00
|
|
|
error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
|
2021-03-18 01:45:49 +00:00
|
|
|
--> $DIR/mut-borrow-of-mut-ref.rs:7:7
|
2018-05-25 18:33:15 +00:00
|
|
|
|
|
2021-03-18 01:45:49 +00:00
|
|
|
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
|
|
|
|
|
|
2021-08-29 08:48:36 +00:00
|
|
|
LL - h(&mut b);
|
|
|
|
LL + h(b);
|
|
|
|
|
|
2018-05-25 18:33:15 +00:00
|
|
|
|
2020-10-08 14:21:12 +00:00
|
|
|
error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
|
2021-03-18 01:45:49 +00:00
|
|
|
--> $DIR/mut-borrow-of-mut-ref.rs:11:12
|
2020-10-08 14:21:12 +00:00
|
|
|
|
|
|
|
|
LL | g(&mut &mut b);
|
2021-03-18 01:45:49 +00:00
|
|
|
| ^^^^^^ 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
|
|
|
|
|
|
2021-08-29 08:48:36 +00:00
|
|
|
LL - g(&mut &mut b);
|
|
|
|
LL + g(&mut b);
|
|
|
|
|
|
2021-03-18 01:45:49 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2021-08-29 08:48:36 +00:00
|
|
|
LL - h(&mut &mut b);
|
|
|
|
LL + h(&mut b);
|
|
|
|
|
|
2020-10-08 14:21:12 +00:00
|
|
|
|
2021-03-18 01:45:49 +00:00
|
|
|
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) {
|
2021-08-29 08:48:36 +00:00
|
|
|
| +++
|
2021-03-18 01:45:49 +00:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
2018-05-25 18:33:15 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|