Skip to content

Commit

Permalink
Rollup merge of rust-lang#123967 - RalfJung:static_mut_refs, r=Nilstrieb
Browse files Browse the repository at this point in the history
static_mut_refs: use raw pointers to remove the remaining FIXME

Using `SyncUnsafeCell` would not make a lot of sense IMO.
  • Loading branch information
jieyouxu authored Apr 20, 2024
2 parents a2a949b + 9e4e444 commit be9d7ca
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
@@ -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]
#![allow(dead_code, non_camel_case_types, internal_features)]

Expand Down Expand Up @@ -112,9 +121,7 @@ fn start<T: Termination + 'static>(

static mut NUM: u8 = 6 * 7;

// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
#[allow(static_mut_refs)]
static NUM_REF: &'static u8 = unsafe { &NUM };
static NUM_REF: &'static u8 = unsafe { &*&raw const NUM };

unsafe fn zeroed<T>() -> T {
let mut uninit = MaybeUninit { uninit: () };
Expand Down

0 comments on commit be9d7ca

Please sign in to comment.