Skip to content

Commit fe49aae

Browse files
jannauojeda
authored andcommitted
rust: init: Fix generics in *_init! macros
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. Cc: [email protected] Fixes: 578eb8b ("rust: pin-init: move the default error behavior of `try_[pin_]init`") Signed-off-by: Janne Grunau <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 86731a2 commit fe49aae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rust/kernel/init.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,14 @@ macro_rules! try_init {
231231
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
232232
$($fields:tt)*
233233
}) => {
234-
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
234+
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
235235
$($fields)*
236236
}? $crate::error::Error)
237237
};
238238
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
239239
$($fields:tt)*
240240
}? $err:ty) => {
241-
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
241+
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
242242
$($fields)*
243243
}? $err)
244244
};
@@ -291,14 +291,14 @@ macro_rules! try_pin_init {
291291
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
292292
$($fields:tt)*
293293
}) => {
294-
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
294+
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
295295
$($fields)*
296296
}? $crate::error::Error)
297297
};
298298
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
299299
$($fields:tt)*
300300
}? $err:ty) => {
301-
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
301+
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
302302
$($fields)*
303303
}? $err)
304304
};

0 commit comments

Comments
 (0)