Skip to content

Commit

Permalink
Use stabilized #[feature(pointer_is_aligned)]
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed May 2, 2024
1 parent c7bf893 commit 5cc2522
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions crates/sel4-runtime-common/src/ctors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ pub unsafe fn run_ctors() {
// Cast to usize for comparison, otherwise rustc seems to apply an erroneous optimization
// assuming __init_array_start != __init_array_end.
if start as usize != end as usize {
if start.align_offset(mem::size_of::<Ctor>()) != 0
|| end.align_offset(mem::size_of::<Ctor>()) != 0
{
if !start.is_aligned() || !end.is_aligned() {
abort!("'.init_array' section is not properly aligned");
}

Expand Down
6 changes: 3 additions & 3 deletions hacking/unstable-feature-monitoring/wishlist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
feature(riscv_ext_intrinsics),
)]

// For pointer::is_aligned(_to)?
// For pointer::is_aligned_to?
//
// For now, use:
// ```
// assert_eq!(ptr.cast::<()>().align_offset(x), 0)
// ```
// (See definitions of pointer::is_aligned(_to)?)
#![feature(pointer_is_aligned)]
// (See definitions of pointer::is_aligned_to?)
#![feature(pointer_is_aligned_to)]

// Without these, the more invasive sel4_cfg_if! and sel4_cfg_wrap_match! must be used instead of
// #[sel4_cfg] and #[sel4_cfg_match] on expressions and non-inline module declarations.
Expand Down

0 comments on commit 5cc2522

Please sign in to comment.