rust/src/test/ui/unsafe/ranged_ints3_const.stderr

25 lines
1003 B
Plaintext
Raw Normal View History

error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
--> $DIR/ranged_ints3_const.rs:12:13
|
2019-03-09 12:03:44 +00:00
LL | let y = &x.0;
| ^^^^
error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
--> $DIR/ranged_ints3_const.rs:19:22
|
2019-03-09 12:03:44 +00:00
LL | let y = unsafe { &x.0 };
| ^^^^
error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block
--> $DIR/ranged_ints3_const.rs:12:13
|
2019-03-09 12:03:44 +00:00
LL | let y = &x.0;
| ^^^^ borrow of layout constrained field with interior mutability
|
= note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0133, E0492.
For more information about an error, try `rustc --explain E0133`.