Fix AtomicPtr::from_mut align check: Avoid generic arg in const expr.

See #76200.
This commit is contained in:
Mara Bos 2020-09-12 21:20:17 +02:00
parent 458aaba084
commit 3be40b22c8

View File

@ -858,7 +858,7 @@ impl<T> AtomicPtr<T> {
#[inline]
#[unstable(feature = "atomic_from_mut", issue = "76314")]
pub fn from_mut(v: &mut *mut T) -> &Self {
let [] = [(); align_of::<Self>() - align_of::<*mut T>()];
let [] = [(); align_of::<AtomicPtr<()>>() - align_of::<*mut ()>()];
// SAFETY:
// - the mutable reference guarantees unique ownership.
// - the alignment of `*mut T` and `Self` is the same on all platforms