* [PATCH] rust: init: Fix generics in *_init! macros
@ 2025-06-28 11:36 ` Janne Grunau via B4 Relay
0 siblings, 0 replies; 7+ messages in thread
From: Janne Grunau @ 2025-06-28 11:36 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, Janne Grunau
The match pattern for a optional trailing comma in the list of generics
is erroneously repeated in the code block resulting in following error:
| error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
| --> rust/kernel/init.rs:301:73
| |
| 301 | ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
| | ^^^
Remove "$(,)?" from all code blocks in the try_init! and try_pin_init!
definitions.
Fixes: 578eb8b6db13 ("rust: pin-init: move the default error behavior of `try_[pin_]init`")
Signed-off-by: Janne Grunau <j@jannau.net>
---
rust/kernel/init.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 8d228c23795445e379b40f662e1c355a934cbd13..21ef202ab0dbfa3cb28cd20d29d9bfdba4f1f97f 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -231,14 +231,14 @@ macro_rules! try_init {
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}) => {
- ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $crate::error::Error)
};
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}? $err:ty) => {
- ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $err)
};
@@ -291,14 +291,14 @@ macro_rules! try_pin_init {
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}) => {
- ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $crate::error::Error)
};
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}? $err:ty) => {
- ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $err)
};
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250628-rust_init_trailing_comma-e4f1c9855462
Best regards,
--
Janne Grunau <j@jannau.net>
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH] rust: init: Fix generics in *_init! macros
@ 2025-06-28 11:36 ` Janne Grunau via B4 Relay
0 siblings, 0 replies; 7+ messages in thread
From: Janne Grunau via B4 Relay @ 2025-06-28 11:36 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, Janne Grunau
From: Janne Grunau <j@jannau.net>
The match pattern for a optional trailing comma in the list of generics
is erroneously repeated in the code block resulting in following error:
| error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
| --> rust/kernel/init.rs:301:73
| |
| 301 | ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
| | ^^^
Remove "$(,)?" from all code blocks in the try_init! and try_pin_init!
definitions.
Fixes: 578eb8b6db13 ("rust: pin-init: move the default error behavior of `try_[pin_]init`")
Signed-off-by: Janne Grunau <j@jannau.net>
---
rust/kernel/init.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 8d228c23795445e379b40f662e1c355a934cbd13..21ef202ab0dbfa3cb28cd20d29d9bfdba4f1f97f 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -231,14 +231,14 @@ macro_rules! try_init {
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}) => {
- ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $crate::error::Error)
};
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}? $err:ty) => {
- ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $err)
};
@@ -291,14 +291,14 @@ macro_rules! try_pin_init {
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}) => {
- ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $crate::error::Error)
};
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
$($fields:tt)*
}? $err:ty) => {
- ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
+ ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
$($fields)*
}? $err)
};
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250628-rust_init_trailing_comma-e4f1c9855462
Best regards,
--
Janne Grunau <j@jannau.net>
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] rust: init: Fix generics in *_init! macros
2025-06-28 11:36 ` Janne Grunau via B4 Relay
(?)
@ 2025-06-28 12:29 ` Benno Lossin
2025-06-28 12:41 ` Miguel Ojeda
2025-06-28 13:25 ` Janne Grunau
-1 siblings, 2 replies; 7+ messages in thread
From: Benno Lossin @ 2025-06-28 12:29 UTC (permalink / raw)
To: j, 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 Sat Jun 28, 2025 at 1:36 PM CEST, Janne Grunau via B4 Relay wrote:
> From: Janne Grunau <j@jannau.net>
>
> The match pattern for a optional trailing comma in the list of generics
> is erroneously repeated in the code block resulting in following error:
>
> | error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
> | --> rust/kernel/init.rs:301:73
> | |
> | 301 | ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
> | | ^^^
>
> Remove "$(,)?" from all code blocks in the try_init! and try_pin_init!
> definitions.
Oops, that's a good catch! Seems like nobody used the generics before...
Do you need this to go in as a fix into v6.16, or is it fine if I pick
it for v6.17, since it's only a build failure?
@Miguel any opinion?
---
Cheers,
Benno
> Fixes: 578eb8b6db13 ("rust: pin-init: move the default error behavior of `try_[pin_]init`")
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> rust/kernel/init.rs | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] rust: init: Fix generics in *_init! macros
2025-06-28 12:29 ` Benno Lossin
@ 2025-06-28 12:41 ` Miguel Ojeda
2025-06-28 13:25 ` Janne Grunau
1 sibling, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-06-28 12:41 UTC (permalink / raw)
To: Benno Lossin
Cc: j, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
On Sat, Jun 28, 2025 at 2:29 PM Benno Lossin <lossin@kernel.org> wrote:
>
> Oops, that's a good catch! Seems like nobody used the generics before...
>
> Do you need this to go in as a fix into v6.16, or is it fine if I pick
> it for v6.17, since it's only a build failure?
>
> @Miguel any opinion?
If it is a fix, then we can just pick it. I have to send others
anyway, so I will be doing a fixes PR in a week or so.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rust: init: Fix generics in *_init! macros
2025-06-28 12:29 ` Benno Lossin
2025-06-28 12:41 ` Miguel Ojeda
@ 2025-06-28 13:25 ` Janne Grunau
2025-06-28 13:49 ` Benno Lossin
1 sibling, 1 reply; 7+ messages in thread
From: Janne Grunau @ 2025-06-28 13:25 UTC (permalink / raw)
To: Benno Lossin
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
On Sat, Jun 28, 2025 at 02:29:11PM +0200, Benno Lossin wrote:
> On Sat Jun 28, 2025 at 1:36 PM CEST, Janne Grunau via B4 Relay wrote:
> > From: Janne Grunau <j@jannau.net>
> >
> > The match pattern for a optional trailing comma in the list of generics
> > is erroneously repeated in the code block resulting in following error:
> >
> > | error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
> > | --> rust/kernel/init.rs:301:73
> > | |
> > | 301 | ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
> > | | ^^^
> >
> > Remove "$(,)?" from all code blocks in the try_init! and try_pin_init!
> > definitions.
>
> Oops, that's a good catch! Seems like nobody used the generics before...
Nobody upstream, it's used downstream in the asahi tree.
> Do you need this to go in as a fix into v6.16, or is it fine if I pick
> it for v6.17, since it's only a build failure?
I don't need it since I have to carry it anyway in the downstream tree
but I think it would be good idea to fix it in v6.16.
Since it's in the kernel crate (the macros in pin-init are fine) I'd
propose that Miguel picks it with other rust fixes.
Janne
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] rust: init: Fix generics in *_init! macros
2025-06-28 13:25 ` Janne Grunau
@ 2025-06-28 13:49 ` Benno Lossin
0 siblings, 0 replies; 7+ messages in thread
From: Benno Lossin @ 2025-06-28 13:49 UTC (permalink / raw)
To: Janne Grunau
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
On Sat Jun 28, 2025 at 3:25 PM CEST, Janne Grunau wrote:
> On Sat, Jun 28, 2025 at 02:29:11PM +0200, Benno Lossin wrote:
>> On Sat Jun 28, 2025 at 1:36 PM CEST, Janne Grunau via B4 Relay wrote:
>> > From: Janne Grunau <j@jannau.net>
>> >
>> > The match pattern for a optional trailing comma in the list of generics
>> > is erroneously repeated in the code block resulting in following error:
>> >
>> > | error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
>> > | --> rust/kernel/init.rs:301:73
>> > | |
>> > | 301 | ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
>> > | | ^^^
>> >
>> > Remove "$(,)?" from all code blocks in the try_init! and try_pin_init!
>> > definitions.
>>
>> Oops, that's a good catch! Seems like nobody used the generics before...
>
> Nobody upstream, it's used downstream in the asahi tree.
>
>> Do you need this to go in as a fix into v6.16, or is it fine if I pick
>> it for v6.17, since it's only a build failure?
>
> I don't need it since I have to carry it anyway in the downstream tree
> but I think it would be good idea to fix it in v6.16.
> Since it's in the kernel crate (the macros in pin-init are fine) I'd
> propose that Miguel picks it with other rust fixes.
Sounds good!
Reviewed-by: Benno Lossin <lossin@kernel.org>
---
Cheers,
Benno
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rust: init: Fix generics in *_init! macros
2025-06-28 11:36 ` Janne Grunau via B4 Relay
(?)
(?)
@ 2025-06-29 19:31 ` Miguel Ojeda
-1 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-06-29 19:31 UTC (permalink / raw)
To: j
Cc: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Fiona Behrens, rust-for-linux, linux-kernel
On Sat, Jun 28, 2025 at 1:36 PM Janne Grunau via B4 Relay
<devnull+j.jannau.net@kernel.org> wrote:
>
> From: Janne Grunau <j@jannau.net>
>
> The match pattern for a optional trailing comma in the list of generics
> is erroneously repeated in the code block resulting in following error:
>
> | error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
> | --> rust/kernel/init.rs:301:73
> | |
> | 301 | ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
> | | ^^^
>
> Remove "$(,)?" from all code blocks in the try_init! and try_pin_init!
> definitions.
>
> Fixes: 578eb8b6db13 ("rust: pin-init: move the default error behavior of `try_[pin_]init`")
> Signed-off-by: Janne Grunau <j@jannau.net>
Applied to `rust-fixes` -- thanks everyone!
Cc: stable@vger.kernel.org
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-29 19:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28 11:36 [PATCH] rust: init: Fix generics in *_init! macros Janne Grunau
2025-06-28 11:36 ` Janne Grunau via B4 Relay
2025-06-28 12:29 ` Benno Lossin
2025-06-28 12:41 ` Miguel Ojeda
2025-06-28 13:25 ` Janne Grunau
2025-06-28 13:49 ` Benno Lossin
2025-06-29 19:31 ` Miguel Ojeda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.