The recently landed patch rust_binder: add additional alignment checks adds this helper to Rust Binder:
fn is_aligned(value: usize, to: usize) -> bool {
value % to == 0
}
This is done because is_multiple_of is not available prior to Rust v1.87.0. However, I would like to replace it with is_multiple_of as a follow-up change.
This may be worked around using the same strategy as rust: enable slice_flatten feature and provide it through an extension trait.
Note that if this change is implemented after Rust for Linux bumps its Minimum Supported Rust version to 1.85.0, then this may instead be implemented by the same strategy as rust: enable raw_ref_op feature, as the is_multiple_of method was added as unstable in rustc v1.82.0.
The recently landed patch
rust_binder: add additional alignment checksadds this helper to Rust Binder:This is done because
is_multiple_ofis not available prior to Rust v1.87.0. However, I would like to replace it withis_multiple_ofas a follow-up change.This may be worked around using the same strategy as
rust: enable slice_flatten feature and provide it through an extension trait.Note that if this change is implemented after Rust for Linux bumps its Minimum Supported Rust version to 1.85.0, then this may instead be implemented by the same strategy as
rust: enable raw_ref_op feature, as theis_multiple_ofmethod was added as unstable in rustc v1.82.0.