We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
pointer::is_aligned
1 parent fc109bb commit 25164b4Copy full SHA for 25164b4
library/alloc/src/boxed/thin.rs
@@ -224,7 +224,7 @@ impl<H> WithHeader<H> {
224
// will always result in an aligned header pointer, it just may not point to the
225
// beginning of the allocation.
226
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);
+ debug_assert!(hp.is_aligned());
228
hp
229
}
230
library/alloc/src/lib.rs
@@ -168,6 +168,7 @@
168
#![feature(nll)] // Not necessary, but here to test the `nll` feature.
169
#![feature(rustc_allow_const_fn_unstable)]
170
#![feature(rustc_attrs)]
171
+#![feature(pointer_is_aligned)]
172
#![feature(slice_internals)]
173
#![feature(staged_api)]
174
#![cfg_attr(test, feature(test))]
0 commit comments