* [PATCH 0/3] pin-init: fix issues found with new CI
@ 2025-04-14 19:59 Benno Lossin
2025-04-14 20:00 ` [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module Benno Lossin
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Benno Lossin @ 2025-04-14 19:59 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: rust-for-linux
I changed the CI upstream [1] and found a couple of smaller issues. I
again used my automatic sync script for this patch series, so if
anything (even small things) looks off let me know!
[1]: https://github.com/Rust-for-Linux/pin-init/pull/33
Benno Lossin (3):
rust: pin-init: internal: skip rustfmt formatting of kernel-only
module
rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
rust: pin-init: examples: use `allow` instead of `expect`
rust/pin-init/examples/linked_list.rs | 1 +
rust/pin-init/examples/mutex.rs | 1 +
rust/pin-init/examples/pthread_mutex.rs | 4 +++-
rust/pin-init/examples/static_init.rs | 1 +
rust/pin-init/internal/src/lib.rs | 1 +
5 files changed, 7 insertions(+), 1 deletion(-)
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
--
2.48.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module
2025-04-14 19:59 [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
@ 2025-04-14 20:00 ` Benno Lossin
2025-04-16 15:23 ` Christian Schrefl
2025-04-14 20:00 ` [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)` Benno Lossin
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Benno Lossin @ 2025-04-14 20:00 UTC (permalink / raw)
To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens
Cc: rust-for-linux, linux-kernel
The `quote` module only is available in the kernel and thus running
`cargo fmt` or `rustfmt internal/src/lib.rs` in the user-space
repository [1] results in:
error: couldn't read `~/pin-init/internal/src/../../../macros/quote.rs`: No such file or directory (os error 2)
--> ~/pin-init/internal/src/lib.rs:25:1
|
25 | mod quote;
| ^^^^^^^^^^
Error writing files: failed to resolve mod `quote`: ~/pin-init/internal/src/../../../macros/quote.rs does not exist
Thus mark it with `rustfmt::skip` when compiling without kernel support.
Link: https://github.com/Rust-for-Linux/pin-init [1]
Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/a6caf1945e51da38761aab4dffa56e63e2baa218
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
---
rust/pin-init/internal/src/lib.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/pin-init/internal/src/lib.rs b/rust/pin-init/internal/src/lib.rs
index babe5e878550..56aa9ecc1e1a 100644
--- a/rust/pin-init/internal/src/lib.rs
+++ b/rust/pin-init/internal/src/lib.rs
@@ -22,6 +22,7 @@
#[cfg(kernel)]
#[path = "../../../macros/quote.rs"]
#[macro_use]
+#[cfg_attr(not(kernel), rustfmt::skip)]
mod quote;
#[cfg(not(kernel))]
#[macro_use]
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
2025-04-14 19:59 [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
2025-04-14 20:00 ` [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module Benno Lossin
@ 2025-04-14 20:00 ` Benno Lossin
2025-04-15 9:26 ` Alice Ryhl
2025-04-14 20:00 ` [PATCH 3/3] rust: pin-init: examples: use `allow` instead of `expect` Benno Lossin
2025-04-21 21:23 ` [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
3 siblings, 1 reply; 9+ messages in thread
From: Benno Lossin @ 2025-04-14 20:00 UTC (permalink / raw)
To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens
Cc: rust-for-linux, linux-kernel
`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(+)
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},
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] rust: pin-init: examples: use `allow` instead of `expect`
2025-04-14 19:59 [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
2025-04-14 20:00 ` [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module Benno Lossin
2025-04-14 20:00 ` [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)` Benno Lossin
@ 2025-04-14 20:00 ` Benno Lossin
2025-04-21 21:23 ` [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
3 siblings, 0 replies; 9+ messages in thread
From: Benno Lossin @ 2025-04-14 20:00 UTC (permalink / raw)
To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens
Cc: rust-for-linux, linux-kernel
Rust 1.78 doesn't emit a `dead_code` error on the annotated element,
resulting in the `unfulfilled_lint_expectations` error. Rust 1.85 does
emit the `dead_code` error, so we still need an `allow`.
Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/0e28cbb895bd29f896a59b40e8ed506ea7bef13c
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
---
rust/pin-init/examples/pthread_mutex.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/pin-init/examples/pthread_mutex.rs b/rust/pin-init/examples/pthread_mutex.rs
index f020dd266506..e28a0bfd4179 100644
--- a/rust/pin-init/examples/pthread_mutex.rs
+++ b/rust/pin-init/examples/pthread_mutex.rs
@@ -42,7 +42,7 @@ fn drop(self: Pin<&mut Self>) {
#[derive(Debug)]
pub enum Error {
- #[expect(dead_code)]
+ #[allow(dead_code)]
IO(std::io::Error),
Alloc,
}
--
2.48.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
2025-04-14 20:00 ` [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)` Benno Lossin
@ 2025-04-15 9:26 ` Alice Ryhl
2025-04-16 21:58 ` Benno Lossin
0 siblings, 1 reply; 9+ messages in thread
From: Alice Ryhl @ 2025-04-15 9:26 UTC (permalink / raw)
To: Benno Lossin
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module
2025-04-14 20:00 ` [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module Benno Lossin
@ 2025-04-16 15:23 ` Christian Schrefl
0 siblings, 0 replies; 9+ messages in thread
From: Christian Schrefl @ 2025-04-16 15:23 UTC (permalink / raw)
To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens
Cc: rust-for-linux, linux-kernel
On 14.04.25 10:00 PM, Benno Lossin wrote:
> The `quote` module only is available in the kernel and thus running
> `cargo fmt` or `rustfmt internal/src/lib.rs` in the user-space
> repository [1] results in:
>
> error: couldn't read `~/pin-init/internal/src/../../../macros/quote.rs`: No such file or directory (os error 2)
> --> ~/pin-init/internal/src/lib.rs:25:1
> |
> 25 | mod quote;
> | ^^^^^^^^^^
>
> Error writing files: failed to resolve mod `quote`: ~/pin-init/internal/src/../../../macros/quote.rs does not exist
>
> Thus mark it with `rustfmt::skip` when compiling without kernel support.
>
> Link: https://github.com/Rust-for-Linux/pin-init [1]
> Link: https://github.com/Rust-for-Linux/pin-init/pull/33/commits/a6caf1945e51da38761aab4dffa56e63e2baa218
> Signed-off-by: Benno Lossin <benno.lossin@proton.me>
> ---
> rust/pin-init/internal/src/lib.rs | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/rust/pin-init/internal/src/lib.rs b/rust/pin-init/internal/src/lib.rs
> index babe5e878550..56aa9ecc1e1a 100644
> --- a/rust/pin-init/internal/src/lib.rs
> +++ b/rust/pin-init/internal/src/lib.rs
> @@ -22,6 +22,7 @@
> #[cfg(kernel)]
> #[path = "../../../macros/quote.rs"]
> #[macro_use]
> +#[cfg_attr(not(kernel), rustfmt::skip)]
> mod quote;
> #[cfg(not(kernel))]
> #[macro_use]
Reviewed-by: Christian Schrefl <chrisi.schrefl@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
2025-04-15 9:26 ` Alice Ryhl
@ 2025-04-16 21:58 ` Benno Lossin
2025-04-17 12:07 ` Benno Lossin
0 siblings, 1 reply; 9+ messages in thread
From: Benno Lossin @ 2025-04-16 21:58 UTC (permalink / raw)
To: Alice Ryhl
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
2025-04-16 21:58 ` Benno Lossin
@ 2025-04-17 12:07 ` Benno Lossin
0 siblings, 0 replies; 9+ messages in thread
From: Benno Lossin @ 2025-04-17 12:07 UTC (permalink / raw)
To: Alice Ryhl
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] pin-init: fix issues found with new CI
2025-04-14 19:59 [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
` (2 preceding siblings ...)
2025-04-14 20:00 ` [PATCH 3/3] rust: pin-init: examples: use `allow` instead of `expect` Benno Lossin
@ 2025-04-21 21:23 ` Benno Lossin
3 siblings, 0 replies; 9+ messages in thread
From: Benno Lossin @ 2025-04-21 21:23 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: rust-for-linux
On Mon Apr 14, 2025 at 9:59 PM CEST, Benno Lossin wrote:
> I changed the CI upstream [1] and found a couple of smaller issues. I
> again used my automatic sync script for this patch series, so if
> anything (even small things) looks off let me know!
>
> [1]: https://github.com/Rust-for-Linux/pin-init/pull/33
>
> Benno Lossin (3):
> rust: pin-init: internal: skip rustfmt formatting of kernel-only
> module
> rust: pin-init: examples: conditionally enable `feature(lint_reasons)`
> rust: pin-init: examples: use `allow` instead of `expect`
>
> rust/pin-init/examples/linked_list.rs | 1 +
> rust/pin-init/examples/mutex.rs | 1 +
> rust/pin-init/examples/pthread_mutex.rs | 4 +++-
> rust/pin-init/examples/static_init.rs | 1 +
> rust/pin-init/internal/src/lib.rs | 1 +
> 5 files changed, 7 insertions(+), 1 deletion(-)
>
>
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
Applied to pin-init-next -- thanks!
---
Cheers,
Benno
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-04-21 21:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 19:59 [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
2025-04-14 20:00 ` [PATCH 1/3] rust: pin-init: internal: skip rustfmt formatting of kernel-only module Benno Lossin
2025-04-16 15:23 ` Christian Schrefl
2025-04-14 20:00 ` [PATCH 2/3] rust: pin-init: examples: conditionally enable `feature(lint_reasons)` Benno Lossin
2025-04-15 9:26 ` Alice Ryhl
2025-04-16 21:58 ` Benno Lossin
2025-04-17 12:07 ` Benno Lossin
2025-04-14 20:00 ` [PATCH 3/3] rust: pin-init: examples: use `allow` instead of `expect` Benno Lossin
2025-04-21 21:23 ` [PATCH 0/3] pin-init: fix issues found with new CI Benno Lossin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).