Skip to content

Commit 5d6f1a1

Browse files
committed
Move use align_of in atomic.rs into the places where it is used.
1 parent 7a04ff6 commit 5d6f1a1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/core/src/sync/atomic.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ use crate::cell::UnsafeCell;
111111
use crate::fmt;
112112
use crate::intrinsics;
113113

114-
#[allow(unused_imports)]
115-
use crate::mem::align_of;
116-
117114
use crate::hint::spin_loop;
118115

119116
/// Signals the processor that it is inside a busy-wait spin-loop ("spin lock").
@@ -861,6 +858,7 @@ impl<T> AtomicPtr<T> {
861858
#[cfg(target_has_atomic_equal_alignment = "ptr")]
862859
#[unstable(feature = "atomic_from_mut", issue = "76314")]
863860
pub fn from_mut(v: &mut *mut T) -> &Self {
861+
use crate::mem::align_of;
864862
let [] = [(); align_of::<AtomicPtr<()>>() - align_of::<*mut ()>()];
865863
// SAFETY:
866864
// - the mutable reference guarantees unique ownership.
@@ -1311,6 +1309,7 @@ assert_eq!(some_int, 100);
13111309
#[$cfg_align]
13121310
#[unstable(feature = "atomic_from_mut", issue = "76314")]
13131311
pub fn from_mut(v: &mut $int_type) -> &Self {
1312+
use crate::mem::align_of;
13141313
let [] = [(); align_of::<Self>() - align_of::<$int_type>()];
13151314
// SAFETY:
13161315
// - the mutable reference guarantees unique ownership.

0 commit comments

Comments
 (0)