File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ pub macro thread_local_inner {
1111 ( @key $t: ty, const $init: expr) => { {
1212 #[ inline] // see comments below
1313 #[ deny( unsafe_op_in_unsafe_fn) ]
14- // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
15- #[ allow( static_mut_refs) ]
1614 unsafe fn __getit (
1715 _init : $crate:: option:: Option < & mut $crate:: option:: Option < $t> > ,
1816 ) -> $crate:: option:: Option < & ' static $t> {
@@ -25,7 +23,8 @@ pub macro thread_local_inner {
2523 // FIXME(#84224) this should come after the `target_thread_local`
2624 // block.
2725 static mut VAL : $t = INIT_EXPR ;
28- unsafe { $crate:: option:: Option :: Some ( & VAL ) }
26+ // SAFETY: we only ever create shared references, so there's no mutable aliasing.
27+ unsafe { $crate:: option:: Option :: Some ( & * $crate:: ptr:: addr_of!( VAL ) ) }
2928 }
3029
3130 unsafe {
You can’t perform that action at this time.
0 commit comments