2018-08-08 07:28:26 -05:00
|
|
|
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-access-permissions.rs:9:19
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-17 04:52:07 -05:00
|
|
|
LL | let _y1 = &mut x;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^ cannot borrow as mutable
|
2023-01-01 02:06:31 -06:00
|
|
|
|
|
|
|
|
help: consider changing this to be mutable
|
|
|
|
|
|
|
|
|
LL | let mut x = 1;
|
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0596]: cannot borrow immutable static item `static_x` as mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-access-permissions.rs:14:19
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-17 04:52:07 -05:00
|
|
|
LL | let _y1 = &mut static_x;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-access-permissions.rs:22:19
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-17 04:52:07 -05:00
|
|
|
LL | let _y1 = &mut *box_x;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^^^^^^ cannot borrow as mutable
|
2023-01-01 02:06:31 -06:00
|
|
|
|
|
|
|
|
help: consider changing this to be mutable
|
|
|
|
|
|
|
|
|
LL | let mut box_x = Box::new(1);
|
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-access-permissions.rs:30:19
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-17 04:52:07 -05:00
|
|
|
LL | let _y1 = &mut *ref_x;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
2022-12-28 23:52:57 -06:00
|
|
|
|
|
|
|
|
help: consider changing this to be a mutable reference
|
|
|
|
|
|
|
|
|
LL | let ref_x = &mut x;
|
2023-04-19 01:22:03 -05:00
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-access-permissions.rs:39:23
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-17 04:52:07 -05:00
|
|
|
LL | let _y1 = &mut *ptr_x;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
|
2022-12-28 23:52:57 -06:00
|
|
|
|
|
|
|
|
help: consider changing this to be a mutable pointer
|
|
|
|
|
|
|
|
|
LL | let ptr_x : *const _ = &mut x;
|
2023-04-19 01:22:03 -05:00
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-access-permissions.rs:48:18
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-17 04:52:07 -05:00
|
|
|
LL | let _y = &mut *foo_ref.f;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
|
2022-12-28 23:52:57 -06:00
|
|
|
|
|
|
|
|
help: consider changing this to be a mutable reference
|
|
|
|
|
|
|
|
|
LL | let foo_ref = &mut foo;
|
2023-04-19 01:22:03 -05:00
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0596`.
|