Skip to content

Commit 67dfc57

Browse files
committed
Allow interior_mutable_consts lint in std for INIT const
1 parent 39e0fb6 commit 67dfc57

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")]
@@ -3301,6 +3302,7 @@ macro_rules! atomic_int_ptr_sized {
33013302
note = "the `new` function is now preferred",
33023303
suggestion = "AtomicIsize::new(0)",
33033304
)]
3305+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
33043306
pub const ATOMIC_ISIZE_INIT: AtomicIsize = AtomicIsize::new(0);
33053307

33063308
/// An [`AtomicUsize`] initialized to `0`.
@@ -3311,6 +3313,7 @@ macro_rules! atomic_int_ptr_sized {
33113313
note = "the `new` function is now preferred",
33123314
suggestion = "AtomicUsize::new(0)",
33133315
)]
3316+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
33143317
pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize::new(0);
33153318
)* };
33163319
}

library/std/src/sync/poison/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), allow(interior_mutable_consts))]
5859
const __INIT: $t = $init;
5960

6061
unsafe {

0 commit comments

Comments
 (0)