Rollup merge of #84291 - RalfJung:thread-local-const-init, r=alexcrichton

fix aliasing violations in thread_local_const_init

Fixes https://github.com/rust-lang/rust/pull/83416#discussion_r615364774

r? `@alexcrichton` `@sfackler`
This commit is contained in:
Dylan DPC 2021-04-19 22:00:09 +02:00 committed by GitHub
commit 761243572e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,7 +217,7 @@ unsafe fn __getit() -> $crate::option::Option<&'static $t> {
// so now.
0 => {
$crate::thread::__FastLocalKeyInner::<$t>::register_dtor(
&VAL as *const _ as *mut u8,
$crate::ptr::addr_of_mut!(VAL) as *mut u8,
destroy,
);
STATE = 1;