Skip to content

Commit b1bc607

Browse files
committed
Allow interior_mutable_consts lint in std for INIT const
1 parent da4de38 commit b1bc607

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

library/core/src/sync/atomic.rs

+3
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ pub enum Ordering {
409409
note = "the `new` function is now preferred",
410410
suggestion = "AtomicBool::new(false)"
411411
)]
412+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
412413
pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool::new(false);
413414

414415
#[cfg(target_has_atomic_load_store = "8")]
@@ -3288,6 +3289,7 @@ macro_rules! atomic_int_ptr_sized {
32883289
note = "the `new` function is now preferred",
32893290
suggestion = "AtomicIsize::new(0)",
32903291
)]
3292+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
32913293
pub const ATOMIC_ISIZE_INIT: AtomicIsize = AtomicIsize::new(0);
32923294

32933295
/// An [`AtomicUsize`] initialized to `0`.
@@ -3298,6 +3300,7 @@ macro_rules! atomic_int_ptr_sized {
32983300
note = "the `new` function is now preferred",
32993301
suggestion = "AtomicUsize::new(0)",
33003302
)]
3303+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
33013304
pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize::new(0);
33023305
)* };
33033306
}

library/std/src/sync/once.rs

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub(crate) enum ExclusiveState {
7474
note = "the `Once::new()` function is now preferred",
7575
suggestion = "Once::new()"
7676
)]
77+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
7778
pub const ONCE_INIT: Once = Once::new();
7879

7980
impl Once {

library/std/src/sys/thread_local/native/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub macro thread_local_inner {
5555

5656
// Used to generate the `LocalKey` value for const-initialized thread locals.
5757
(@key $t:ty, const $init:expr) => {{
58+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
5859
const __INIT: $t = $init;
5960

6061
unsafe {

0 commit comments

Comments
 (0)