Skip to contentSkip to conversation

Patch "rust: pin-init: internal: suppress `non_snake_case` lint in `[pin_]init!`" has been added to the 7.1-stable tree

DISCUSSION Gary Guo 2 participants 2 messages Jul 20 – Jul 21 1 message not in the archive Stable branch

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Gary Guo

author
#1 lore raw
Quoted 7 lines · Sasha Levin

This is a note to let you know that I've just added the patch titled

rust: pin-init: internal: suppress non_snake_case lint in [pin_]init!

to the 7.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 6 lines

The filename of the patch is:
rust-pin-init-internal-suppress-non_snake_case-lint-.patch
and it can be found in the queue-7.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Hi Sasha,

Looks like quite a lot of patches have been picked up as dependency in order to pick this to 7.1.

The warning that this fix addresses are already worked around on the user side, so it probably isn't worth backporting.

Best,
Gary

Quoted 43 lines

commit 54db70c2ed9fb176f2f097a04c55b67071dc0db7

Author: Mirko Adzic <[email protected]>
Date:   Wed May 27 18:19:54 2026 +0100

rust: pin-init: internal: suppress non_snake_case lint in [pin_]init!

[ Upstream commit 5423ef9d4db852835746001d0840231227bb0e39 ]

Allows non_snake_case lint on local variables generated in [pin_]init!.

Conceptually the identifiers in [pin_]init! just references the field names, and are not defining them, so the warning should not be generated, similar to how constructing a struct with non-snake-case field names do no generate these warnings.

Fixes 42415d163e5d ("rust: pin-init: add references to previously initialized fields")
[ Reworded commit message - Gary ]
rust/pin-init/internal/src/init.rs +3 -1
index aba32825fef477..45528ab82f6a82 100644
@@ -307,7 +307,9 @@ fn init_fields(
             #init
 
             #(#cfgs)*
-            #[allow(unused_variables)]
+            // Allow `non_snake_case` since the same warning is going to be reported for the struct
+            // field.
+            #[allow(unused_variables, non_snake_case)]
             let #ident = #guard.let_binding();
         });
 
maintainer
#2 lore raw
Quoted 5 lines · Gary Guo

Looks like quite a lot of patches have been picked up as dependency in order to pick this to 7.1.

The warning that this fix addresses are already worked around on the user side, so it probably isn't worth backporting.

Dropped from the 7.1 queue along with the following dependencies:

- rust: pin-init: internal: remove redundant pin filtering
- rust: pin-init: internal: turn PhantomPinned error into a warning
- rust: pin-init: internal: remove collect_tuple polyfill
- rust: pin-init: internal: pin_data: use closure for handling
- rust: pin-init: internal: pin_data: add struct to record
- rust: pin-init: internal: init: handle code blocks early
- rust: pin-init: internal: use marker on drop guard type for pinned fields
- rust: pin-init: internal: project slots instead of references

Thanks for the report!

Signature · 2 lines
Thanks,
Sasha