Closed
Description
I tried this code:
// Regression test for https://github.com/rust-lang/rust/issues/70673.
// run-pass
#![feature(thread_local)]
#[thread_local]
static A: &u8 = &42;
fn main() {
dbg!(*A);
}
Miri reports:
[src/main.rs:11] *A = 42
error: Undefined Behavior: deallocating immutable allocation alloc1301
|
= note: deallocating immutable allocation alloc1301
= note: (no span available)
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
rustc 1.62.0-nightly (ec77f2524 2022-04-17)
binary: rustc
commit-hash: ec77f252434a532fdb5699ae4f21a3072d211edd
commit-date: 2022-04-17
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0