rust/tests/ui/consts/issue-17718-const-bad-values.stderr
Ding Xiang Fei 1576a6d618
Stabilize const_refs_to_static
update tests

fix bitwidth-sensitive stderr output

use build-fail for asm tests
2024-09-26 13:21:15 +02:00

22 lines
993 B
Plaintext

error[E0764]: mutable references are not allowed in the final value of constants
--> $DIR/issue-17718-const-bad-values.rs:7:34
|
LL | const C1: &'static mut [usize] = &mut [];
| ^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/issue-17718-const-bad-values.rs:11:1
|
LL | const C2: &'static mut i32 = unsafe { &mut S };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
= 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
}
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0080, E0764.
For more information about an error, try `rustc --explain E0080`.