2019-04-22 02:40:08 -05:00
|
|
|
error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
|
2022-12-30 00:46:17 -06:00
|
|
|
--> $DIR/mut-borrow-of-mut-ref.rs:4:10
|
2018-05-25 13:33:15 -05:00
|
|
|
|
|
2022-12-30 00:46:17 -06:00
|
|
|
LL | pub fn f(b: &mut i32) {
|
|
|
|
| ^ not mutable
|
|
|
|
...
|
2021-03-17 20:45:49 -05:00
|
|
|
LL | h(&mut b);
|
2022-12-30 00:46:17 -06:00
|
|
|
| ------ cannot borrow as mutable
|
|
|
|
...
|
|
|
|
LL | g(&mut &mut b);
|
|
|
|
| ------ cannot borrow as mutable
|
2021-03-17 20:45:49 -05:00
|
|
|
|
|
|
|
|
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 03:48:36 -05:00
|
|
|
LL - h(&mut b);
|
|
|
|
LL + h(b);
|
2022-06-08 12:34:57 -05:00
|
|
|
|
|
2021-03-17 20:45:49 -05:00
|
|
|
help: try removing `&mut` here
|
|
|
|
|
|
2021-08-29 03:48:36 -05:00
|
|
|
LL - g(&mut &mut b);
|
|
|
|
LL + g(&mut b);
|
2022-06-08 12:34:57 -05:00
|
|
|
|
|
2021-03-17 20:45:49 -05:00
|
|
|
|
|
|
|
error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable
|
2022-12-30 00:46:17 -06:00
|
|
|
--> $DIR/mut-borrow-of-mut-ref.rs:17:12
|
2021-03-17 20:45:49 -05:00
|
|
|
|
|
|
|
|
LL | h(&mut &mut b);
|
|
|
|
| ^^^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
|
note: the binding is already a mutable borrow
|
2022-12-30 00:46:17 -06:00
|
|
|
--> $DIR/mut-borrow-of-mut-ref.rs:16:13
|
2021-03-17 20:45:49 -05:00
|
|
|
|
|
|
|
|
LL | pub fn g(b: &mut i32) {
|
|
|
|
| ^^^^^^^^
|
|
|
|
help: try removing `&mut` here
|
|
|
|
|
|
2021-08-29 03:48:36 -05:00
|
|
|
LL - h(&mut &mut b);
|
|
|
|
LL + h(&mut b);
|
2022-06-08 12:34:57 -05:00
|
|
|
|
|
2020-10-08 09:21:12 -05:00
|
|
|
|
2021-03-17 20:45:49 -05:00
|
|
|
error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
|
2022-12-30 00:46:17 -06:00
|
|
|
--> $DIR/mut-borrow-of-mut-ref.rs:34:5
|
2021-03-17 20:45:49 -05:00
|
|
|
|
|
|
|
|
LL | f.bar();
|
2023-06-22 15:30:23 -05:00
|
|
|
| ^ cannot borrow as mutable
|
2021-03-17 20:45:49 -05:00
|
|
|
|
|
|
|
|
help: consider making the binding mutable
|
|
|
|
|
|
|
|
|
LL | pub fn baz(mut f: &mut String) {
|
2021-08-29 03:48:36 -05:00
|
|
|
| +++
|
2021-03-17 20:45:49 -05:00
|
|
|
|
2022-12-30 00:46:17 -06:00
|
|
|
error: aborting due to 3 previous errors
|
2018-05-25 13:33:15 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|