Message ID | 20250414195928.129040-3-benno.lossin@proton.me (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | pin-init: fix issues found with new CI | expand |
On Mon, Apr 14, 2025 at 08:00:20PM +0000, Benno Lossin wrote: > `lint_reasons` is unstable in Rust 1.80 and earlier, enable it > conditionally in the examples to allow compiling them with older > compilers. > > Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/ec494fe686b0a97d5b59b5be5a42d3858038ea6a > Signed-off-by: Benno Lossin <benno.lossin@proton.me> Why not just always use #![feature] together with -Astable_features like the kernel does? Alice
On Tue Apr 15, 2025 at 11:26 AM CEST, Alice Ryhl wrote: > On Mon, Apr 14, 2025 at 08:00:20PM +0000, Benno Lossin wrote: >> `lint_reasons` is unstable in Rust 1.80 and earlier, enable it >> conditionally in the examples to allow compiling them with older >> compilers. >> >> Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/ec494fe686b0a97d5b59b5be5a42d3858038ea6a >> Signed-off-by: Benno Lossin <benno.lossin@proton.me> > > Why not just always use #![feature] together with -Astable_features like > the kernel does? I'd like to know when a feature becomes stable, since I don't keep track of them like Miguel does. --- Cheers, Benno
On Wed Apr 16, 2025 at 11:58 PM CEST, Benno Lossin wrote: > On Tue Apr 15, 2025 at 11:26 AM CEST, Alice Ryhl wrote: >> On Mon, Apr 14, 2025 at 08:00:20PM +0000, Benno Lossin wrote: >>> `lint_reasons` is unstable in Rust 1.80 and earlier, enable it >>> conditionally in the examples to allow compiling them with older >>> compilers. >>> >>> Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/ec494fe686b0a97d5b59b5be5a42d3858038ea6a >>> Signed-off-by: Benno Lossin <benno.lossin@proton.me> >> >> Why not just always use #![feature] together with -Astable_features like >> the kernel does? > > I'd like to know when a feature becomes stable, since I don't keep track > of them like Miguel does. Ah one more reason: `pin-init` must compile under stable (when not enabling the `alloc` feature). And having `#![feature(..)]` is not allowed under stable (even if the feature itself is stable). --- Cheers, Benno
diff --git a/rust/pin-init/examples/linked_list.rs b/rust/pin-init/examples/linked_list.rs index 6d7eb0a0ec0d..0bbc7b8d83a1 100644 --- a/rust/pin-init/examples/linked_list.rs +++ b/rust/pin-init/examples/linked_list.rs @@ -2,6 +2,7 @@ #![allow(clippy::undocumented_unsafe_blocks)] #![cfg_attr(feature = "alloc", feature(allocator_api))] +#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))] use core::{ cell::Cell, diff --git a/rust/pin-init/examples/mutex.rs b/rust/pin-init/examples/mutex.rs index 073bb79341d1..3e3630780c96 100644 --- a/rust/pin-init/examples/mutex.rs +++ b/rust/pin-init/examples/mutex.rs @@ -2,6 +2,7 @@ #![allow(clippy::undocumented_unsafe_blocks)] #![cfg_attr(feature = "alloc", feature(allocator_api))] +#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))] #![allow(clippy::missing_safety_doc)] use core::{ diff --git a/rust/pin-init/examples/pthread_mutex.rs b/rust/pin-init/examples/pthread_mutex.rs index 9164298c44c0..f020dd266506 100644 --- a/rust/pin-init/examples/pthread_mutex.rs +++ b/rust/pin-init/examples/pthread_mutex.rs @@ -3,6 +3,8 @@ // inspired by https://github.com/nbdd0121/pin-init/blob/trunk/examples/pthread_mutex.rs #![allow(clippy::undocumented_unsafe_blocks)] #![cfg_attr(feature = "alloc", feature(allocator_api))] +#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))] + #[cfg(not(windows))] mod pthread_mtx { #[cfg(feature = "alloc")] diff --git a/rust/pin-init/examples/static_init.rs b/rust/pin-init/examples/static_init.rs index 3487d761aa26..48531413ab94 100644 --- a/rust/pin-init/examples/static_init.rs +++ b/rust/pin-init/examples/static_init.rs @@ -2,6 +2,7 @@ #![allow(clippy::undocumented_unsafe_blocks)] #![cfg_attr(feature = "alloc", feature(allocator_api))] +#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))] use core::{ cell::{Cell, UnsafeCell},
`lint_reasons` is unstable in Rust 1.80 and earlier, enable it conditionally in the examples to allow compiling them with older compilers. Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/ec494fe686b0a97d5b59b5be5a42d3858038ea6a Signed-off-by: Benno Lossin <benno.lossin@proton.me> --- rust/pin-init/examples/linked_list.rs | 1 + rust/pin-init/examples/mutex.rs | 1 + rust/pin-init/examples/pthread_mutex.rs | 2 ++ rust/pin-init/examples/static_init.rs | 1 + 4 files changed, 5 insertions(+)