rust/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
Ralf Jung 17946c22b1 const-eval error: always say in which item the error occurred
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07 13:42:30 +02:00

20 lines
903 B
Text

error[E0080]: constructing invalid value: encountered a dangling reference (use-after-free)
--> $DIR/dealloc_intrinsic_dangling.rs:11:1
|
LL | const _X: &'static u8 = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value
|
= 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]: memory access failed: ALLOC1 has been freed, so this pointer is dangling
--> $DIR/dealloc_intrinsic_dangling.rs:22:5
|
LL | *reference
| ^^^^^^^^^^ evaluation of `_Y` failed here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.