Skip to content

Commit

Permalink
Use pointer::is_aligned in ThinBox debug assert
Browse files Browse the repository at this point in the history
  • Loading branch information
thomcc committed May 28, 2022
1 parent fc109bb commit 25164b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/alloc/src/boxed/thin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl<H> WithHeader<H> {
// will always result in an aligned header pointer, it just may not point to the
// beginning of the allocation.
let hp = unsafe { self.0.as_ptr().sub(Self::header_size()) as *mut H };
debug_assert!((hp.addr() & (core::mem::align_of::<H>() - 1)) == 0);
debug_assert!(hp.is_aligned());
hp
}

Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
#![feature(nll)] // Not necessary, but here to test the `nll` feature.
#![feature(rustc_allow_const_fn_unstable)]
#![feature(rustc_attrs)]
#![feature(pointer_is_aligned)]
#![feature(slice_internals)]
#![feature(staged_api)]
#![cfg_attr(test, feature(test))]
Expand Down

0 comments on commit 25164b4

Please sign in to comment.