Skip to content

Commit 597c2d2

Browse files
committed
Auto merge of rust-lang#121034 - obeis:improve-static-mut-ref, r=RalfJung
Improve wording of `static_mut_ref` Close rust-lang#120964
2 parents 29c5be1 + e802189 commit 597c2d2

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

panic_unwind/src/seh.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,9 @@ cfg_if::cfg_if! {
261261
}
262262
}
263263

264-
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
265-
#[allow(static_mut_ref)]
264+
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
265+
#[cfg_attr(bootstrap, allow(static_mut_ref))]
266+
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
266267
pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
267268
use core::intrinsics::atomic_store_seqcst;
268269

@@ -324,8 +325,9 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
324325
_CxxThrowException(throw_ptr, &mut THROW_INFO as *mut _ as *mut _);
325326
}
326327

327-
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
328-
#[allow(static_mut_ref)]
328+
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
329+
#[cfg_attr(bootstrap, allow(static_mut_ref))]
330+
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
329331
pub unsafe fn cleanup(payload: *mut u8) -> Box<dyn Any + Send> {
330332
// A null payload here means that we got here from the catch (...) of
331333
// __rust_try. This happens when a non-Rust foreign exception is caught.

std/src/panicking.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@ pub mod panic_count {
337337
#[doc(hidden)]
338338
#[cfg(not(feature = "panic_immediate_abort"))]
339339
#[unstable(feature = "update_panic_count", issue = "none")]
340-
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
341-
#[allow(static_mut_ref)]
340+
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
341+
#[cfg_attr(bootstrap, allow(static_mut_ref))]
342+
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
342343
pub mod panic_count {
343344
use crate::cell::Cell;
344345
use crate::sync::atomic::{AtomicUsize, Ordering};

std/src/sys/pal/common/thread_local/fast_local.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ pub macro thread_local_inner {
1313
(@key $t:ty, const $init:expr) => {{
1414
#[inline]
1515
#[deny(unsafe_op_in_unsafe_fn)]
16-
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
17-
#[allow(static_mut_ref)]
16+
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
17+
#[cfg_attr(bootstrap, allow(static_mut_ref))]
18+
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
1819
unsafe fn __getit(
1920
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
2021
) -> $crate::option::Option<&'static $t> {

std/src/sys/pal/common/thread_local/static_local.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ 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_ref` lint
15-
#[allow(static_mut_ref)]
14+
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
15+
#[cfg_attr(bootstrap, allow(static_mut_ref))]
16+
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
1617
unsafe fn __getit(
1718
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
1819
) -> $crate::option::Option<&'static $t> {

std/src/thread/local.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
180180
#[stable(feature = "rust1", since = "1.0.0")]
181181
#[cfg_attr(not(test), rustc_diagnostic_item = "thread_local_macro")]
182182
#[allow_internal_unstable(thread_local_internals)]
183-
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
184-
#[allow(static_mut_ref)]
183+
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
184+
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
185185
macro_rules! thread_local {
186186
// empty (base case for the recursion)
187187
() => {};

0 commit comments

Comments
 (0)