rust/tests/ui/consts/const_refs_to_static_fail_invalid.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
2.3 KiB
Plaintext
Raw Normal View History

error[E0080]: it is undefined behavior to use this value
--> $DIR/const_refs_to_static_fail_invalid.rs:9:5
|
LL | const C: &bool = unsafe { std::mem::transmute(&S) };
| ^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered 0x0a, but expected a boolean
|
= 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/const_refs_to_static_fail_invalid.rs:25:5
|
LL | const C: &i8 = unsafe { &S };
| ^^^^^^^^^^^^ constructing invalid value: encountered reference to `extern` static 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/const_refs_to_static_fail_invalid.rs:39:5
|
LL | const C: &i32 = unsafe { &S_MUT };
| ^^^^^^^^^^^^^ 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error: could not evaluate constant pattern
--> $DIR/const_refs_to_static_fail_invalid.rs:15:9
|
LL | C => {}
| ^
error: could not evaluate constant pattern
--> $DIR/const_refs_to_static_fail_invalid.rs:31:9
|
LL | C => {}
| ^
error: could not evaluate constant pattern
2024-02-05 14:24:32 -06:00
--> $DIR/const_refs_to_static_fail_invalid.rs:46:9
|
LL | C => {}
| ^
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0080`.