2021-06-13 18:17:11 -05:00
|
|
|
error[E0764]: mutable references are not allowed in the final value of constants
|
|
|
|
--> $DIR/issue-76510.rs:5:29
|
|
|
|
|
|
|
|
|
LL | const S: &'static mut str = &mut " hello ";
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error[E0658]: mutation through a reference is not allowed in constants
|
|
|
|
--> $DIR/issue-76510.rs:5:29
|
|
|
|
|
|
|
|
|
LL | const S: &'static mut str = &mut " hello ";
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
|
|
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow data in a `&` reference as mutable
|
|
|
|
--> $DIR/issue-76510.rs:5:29
|
|
|
|
|
|
|
|
|
LL | const S: &'static mut str = &mut " hello ";
|
|
|
|
| ^^^^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
2022-11-15 05:06:20 -06:00
|
|
|
note: erroneous constant used
|
2022-06-03 06:41:53 -05:00
|
|
|
--> $DIR/issue-76510.rs:11:70
|
|
|
|
|
|
|
|
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
|
2022-11-15 05:06:20 -06:00
|
|
|
| ^
|
2022-06-03 06:41:53 -05:00
|
|
|
|
2022-11-15 05:06:20 -06:00
|
|
|
error: aborting due to 3 previous errors
|
2021-06-13 18:17:11 -05:00
|
|
|
|
2022-11-15 05:06:20 -06:00
|
|
|
Some errors have detailed explanations: E0596, E0658, E0764.
|
|
|
|
For more information about an error, try `rustc --explain E0596`.
|