rust/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
2024-09-15 09:51:32 +02:00

21 lines
908 B
Plaintext

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