rust/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr

54 lines
2.2 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-access-permissions.rs:12:19
2018-08-08 07:28:26 -05:00
|
LL | let x = 1;
| - help: consider changing this to be mutable: `mut x`
...
LL | let _y1 = &mut x;
2018-08-08 07:28:26 -05:00
| ^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow immutable static item `static_x` as mutable
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-access-permissions.rs:18:19
2018-08-08 07:28:26 -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
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-access-permissions.rs:27:19
2018-08-08 07:28:26 -05:00
|
LL | let box_x = Box::new(1);
| ----- help: consider changing this to be mutable: `mut box_x`
...
LL | let _y1 = &mut *box_x;
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^ cannot borrow as mutable
error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-access-permissions.rs:36:19
2018-08-08 07:28:26 -05:00
|
LL | let ref_x = &x;
| -- help: consider changing this to be a mutable reference: `&mut x`
...
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
error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-access-permissions.rs:46:23
2018-08-08 07:28:26 -05:00
|
LL | let ptr_x : *const _ = &x;
| -- help: consider changing this to be a mutable pointer: `&mut x`
...
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
error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-access-permissions.rs:56:18
2018-08-08 07:28:26 -05:00
|
LL | let foo_ref = &foo;
| ---- help: consider changing this to be a mutable reference: `&mut foo`
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
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0596`.