]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: alloc: simplify with `NonNull::add()` now that it is stable
authorMiguel Ojeda <ojeda@kernel.org>
Sun, 5 Apr 2026 23:52:50 +0000 (01:52 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 7 Apr 2026 08:00:24 +0000 (10:00 +0200)
commit161dd7b51e9699a5d1bb2cb24a7eaca23e0facad
treec163817b21f627b8044268bc0a4fc19aec2fd48e
parentf309a6edda535f9a8da4f0620d4c45628465d04e
rust: alloc: simplify with `NonNull::add()` now that it is stable

Currently, we need to go through raw pointers and then re-create the
`NonNull` from the result of offsetting the raw pointer.

`feature(non_null_convenience)` [1] has been stabilized in Rust
1.80.0 [2], which is older than our new minimum Rust version
(Rust 1.85.0).

Thus, now that we bump the Rust minimum version, simplify using
`NonNull::add()` and clean the TODO note.

Link: https://github.com/rust-lang/rust/issues/117691
Link: https://github.com/rust-lang/rust/pull/124498
Reviewed-by: Tamir Duberstein <tamird@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20260405235309.418950-15-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/alloc/allocator/iter.rs