File tree 1 file changed +2
-3
lines changed
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 {
11
11
( @key $t: ty, const $init: expr) => { {
12
12
#[ inline] // see comments below
13
13
#[ deny( unsafe_op_in_unsafe_fn) ]
14
- // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
15
- #[ allow( static_mut_refs) ]
16
14
unsafe fn __getit (
17
15
_init : $crate:: option:: Option < & mut $crate:: option:: Option < $t> > ,
18
16
) -> $crate:: option:: Option < & ' static $t> {
@@ -25,7 +23,8 @@ pub macro thread_local_inner {
25
23
// FIXME(#84224) this should come after the `target_thread_local`
26
24
// block.
27
25
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 ) ) }
29
28
}
30
29
31
30
unsafe {
You can’t perform that action at this time.
0 commit comments