Re: [PATCH v5 21/38] rust: ptr: add const_align_up() and enable inline_const feature

From: Alice Ryhl

Date: Mon Feb 23 2026 - 06:24:28 EST


On Fri, Feb 20, 2026 at 06:09:35PM -0800, John Hubbard wrote:
> Add const_align_up<ALIGN>() to kernel::ptr as the const-compatible
> equivalent of Alignable::align_up(). This uses inline_const to validate
> the alignment at compile time with a clear error message.
>
> Add inline_const to rust_allowed_features in scripts/Makefile.build,
> following the approach in [1].
>
> [1] https://lore.kernel.org/rust-for-linux/20260206171253.2704684-2-gary@xxxxxxxxxx/
>
> Suggested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Suggested-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>

Note that Rust Binder's ptr_align could use this if you want another
user.

Alice