static_mut_refs: use raw pointers to remove the remaining FIXME

This commit is contained in:
Ralf Jung 2024-04-15 17:45:04 +02:00
parent e243f8d0e3
commit 9e4e444a47

View File

@ -1,4 +1,13 @@
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)] #![feature(
no_core,
lang_items,
never_type,
linkage,
extern_types,
thread_local,
repr_simd,
raw_ref_op
)]
#![no_core] #![no_core]
#![allow(dead_code, non_camel_case_types, internal_features)] #![allow(dead_code, non_camel_case_types, internal_features)]
@ -112,9 +121,7 @@ fn start<T: Termination + 'static>(
static mut NUM: u8 = 6 * 7; static mut NUM: u8 = 6 * 7;
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint static NUM_REF: &'static u8 = unsafe { &*&raw const NUM };
#[allow(static_mut_refs)]
static NUM_REF: &'static u8 = unsafe { &NUM };
unsafe fn zeroed<T>() -> T { unsafe fn zeroed<T>() -> T {
let mut uninit = MaybeUninit { uninit: () }; let mut uninit = MaybeUninit { uninit: () };