about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-04-20 21:45:35 +0100
committerGitHub <noreply@github.com>2024-04-20 21:45:35 +0100
commitbe9d7ca97763ad0c613b7ed57ae113e63b32dbe8 (patch)
tree043d2fcccebfb7c53a959d077297921d0b057b27
parenta2a949b0311510d88210950fc7da95203f71b1bd (diff)
parent9e4e444a47f1f2e8c43f7ba5b82b582ae22581ff (diff)
downloadrust-be9d7ca97763ad0c613b7ed57ae113e63b32dbe8.tar.gz
rust-be9d7ca97763ad0c613b7ed57ae113e63b32dbe8.zip
Rollup merge of #123967 - RalfJung:static_mut_refs, r=Nilstrieb
static_mut_refs: use raw pointers to remove the remaining FIXME

Using `SyncUnsafeCell` would not make a lot of sense IMO.
-rw-r--r--example/mini_core_hello_world.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs
index 8b0b9123ac7..efa4be7e15a 100644
--- a/example/mini_core_hello_world.rs
+++ b/example/mini_core_hello_world.rs
@@ -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)]
 
@@ -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: () };