Skip to content

Commit 5c4167b

Browse files
committed
rust: pin-init: examples: conditionally enable feature(lint_reasons)
`lint_reasons` is unstable in Rust 1.80 and earlier, enable it conditionally in the examples to allow compiling them with older compilers. Link: Rust-for-Linux/pin-init@ec494fe Link: https://lore.kernel.org/all/20250414195928.129040-3-benno.lossin@proton.me Signed-off-by: Benno Lossin <benno.lossin@proton.me>
1 parent 3100520 commit 5c4167b

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

rust/pin-init/examples/linked_list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![allow(clippy::undocumented_unsafe_blocks)]
44
#![cfg_attr(feature = "alloc", feature(allocator_api))]
5+
#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
56

67
use core::{
78
cell::Cell,

rust/pin-init/examples/mutex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![allow(clippy::undocumented_unsafe_blocks)]
44
#![cfg_attr(feature = "alloc", feature(allocator_api))]
5+
#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
56
#![allow(clippy::missing_safety_doc)]
67

78
use core::{

rust/pin-init/examples/pthread_mutex.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// inspired by <https://github.com/nbdd0121/pin-init/blob/trunk/examples/pthread_mutex.rs>
44
#![allow(clippy::undocumented_unsafe_blocks)]
55
#![cfg_attr(feature = "alloc", feature(allocator_api))]
6+
#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
7+
68
#[cfg(not(windows))]
79
mod pthread_mtx {
810
#[cfg(feature = "alloc")]

rust/pin-init/examples/static_init.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![allow(clippy::undocumented_unsafe_blocks)]
44
#![cfg_attr(feature = "alloc", feature(allocator_api))]
5+
#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
56

67
use core::{
78
cell::{Cell, UnsafeCell},

0 commit comments

Comments
 (0)