Skip to content

Commit 6a51ec1

Browse files
committed
Allow interior_mutable_consts lint in std for INIT const
1 parent 801d57b commit 6a51ec1

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

library/core/src/sync/atomic.rs

Lines changed: 3 additions & 0 deletions
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")]
@@ -3690,6 +3691,7 @@ macro_rules! atomic_int_ptr_sized {
36903691
note = "the `new` function is now preferred",
36913692
suggestion = "AtomicIsize::new(0)",
36923693
)]
3694+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
36933695
pub const ATOMIC_ISIZE_INIT: AtomicIsize = AtomicIsize::new(0);
36943696

36953697
/// An [`AtomicUsize`] initialized to `0`.
@@ -3700,6 +3702,7 @@ macro_rules! atomic_int_ptr_sized {
37003702
note = "the `new` function is now preferred",
37013703
suggestion = "AtomicUsize::new(0)",
37023704
)]
3705+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
37033706
pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize::new(0);
37043707
)* };
37053708
}

library/std/src/sync/poison/once.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ pub(crate) enum ExclusiveState {
7171
note = "the `Once::new()` function is now preferred",
7272
suggestion = "Once::new()"
7373
)]
74+
#[cfg_attr(not(bootstrap), expect(interior_mutable_consts))]
7475
pub const ONCE_INIT: Once = Once::new();
7576

7677
impl Once {

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

Lines changed: 1 addition & 0 deletions
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+
#[allow(unknown_lints, interior_mutable_consts)] // cfg(bootstrap) for unknown_lints
5859
const __INIT: $t = $init;
5960

6061
unsafe {

0 commit comments

Comments
 (0)