From 7a5418dae1bd2f3bd158278ee1273309bfad01c5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 18 Apr 2021 10:55:09 +0200 Subject: [PATCH] fix aliasing violations in thread_local_const_init --- library/std/src/thread/local.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index 37525e50604..3dcf7e33453 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -217,7 +217,7 @@ macro_rules! __thread_local_inner { // 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;