Skip to content

Commit 25164b4

Browse files
committed
Use pointer::is_aligned in ThinBox debug assert
1 parent fc109bb commit 25164b4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

library/alloc/src/boxed/thin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl<H> WithHeader<H> {
224224
// will always result in an aligned header pointer, it just may not point to the
225225
// beginning of the allocation.
226226
let hp = unsafe { self.0.as_ptr().sub(Self::header_size()) as *mut H };
227-
debug_assert!((hp.addr() & (core::mem::align_of::<H>() - 1)) == 0);
227+
debug_assert!(hp.is_aligned());
228228
hp
229229
}
230230

library/alloc/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
#![feature(nll)] // Not necessary, but here to test the `nll` feature.
169169
#![feature(rustc_allow_const_fn_unstable)]
170170
#![feature(rustc_attrs)]
171+
#![feature(pointer_is_aligned)]
171172
#![feature(slice_internals)]
172173
#![feature(staged_api)]
173174
#![cfg_attr(test, feature(test))]

0 commit comments

Comments
 (0)