]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: pin-init: build: simplify use of nightly features
authorGary Guo <gary@garyguo.net>
Thu, 19 Mar 2026 09:35:24 +0000 (10:35 +0100)
committerBenno Lossin <lossin@kernel.org>
Wed, 25 Mar 2026 09:56:16 +0000 (10:56 +0100)
commit002a121b16c3a20c6e0ff24fc8dad6dab59730f9
treea946dd80194bb0bfb6ce8f97350ff156cc240b14
parentf338e77383789c0cae23ca3d48adcc5e9e137e3c
rust: pin-init: build: simplify use of nightly features

We use some features that are already stable in later versions of Rust,
but only available as unstable features in older Rust versions that the
kernel needs to support.

Instead of checking if a feature is already stable, simply enable them
and allow the warning if the feature is already stable. This avoids the
need of hardcoding whether a feature has been stabilized at a given
version.

`#[feature(...)]` is used when cfg `USE_RUSTC_FEATURES` is enabled. The
build script automatically does this when a nightly compiler is detected
or `RUSTC_BOOTSTRAP` is set.

Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://github.com/Rust-for-Linux/pin-init/commit/885c5d83d7eb778a796d4a17380a0898b0d0a571
[ Added kernel build system changes to always enable USE_RUSTC_FEATURES.
  Moved this commit earlier (swapped with the next one) to avoid a build
  error. - Benno ]
Link: https://patch.msgid.link/20260319093542.3756606-2-lossin@kernel.org
Signed-off-by: Benno Lossin <lossin@kernel.org>
rust/Makefile
rust/pin-init/examples/linked_list.rs
rust/pin-init/examples/mutex.rs
rust/pin-init/examples/pthread_mutex.rs
rust/pin-init/examples/static_init.rs
rust/pin-init/internal/src/lib.rs
rust/pin-init/src/lib.rs