Files
rust/tests/ui/consts/issue-17718-const-bad-values.stderr

22 lines
993 B
Plaintext
Raw Normal View History

2021-01-16 18:05:51 +00:00
error[E0764]: mutable references are not allowed in the final value of constants
--> $DIR/issue-17718-const-bad-values.rs:6:34
2018-07-15 14:11:54 -07:00
|
LL | const C1: &'static mut [usize] = &mut [];
| ^^^^^^^
2018-07-15 14:11:54 -07:00
error[E0080]: it is undefined behavior to use this value
--> $DIR/issue-17718-const-bad-values.rs:10:1
2018-07-15 14:11:54 -07:00
|
LL | const C2: &'static mut i32 = unsafe { &mut S };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
2020-01-10 13:31:36 +00:00
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $PTR, align: $PTR) {
HEX_DUMP
}
2018-07-15 14:11:54 -07:00
2024-08-17 14:19:34 +02:00
error: aborting due to 2 previous errors
2018-07-15 14:11:54 -07:00
Some errors have detailed explanations: E0080, E0764.
For more information about an error, try `rustc --explain E0080`.