mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rust: pin-init: internal: suppress `explicit_outlives_requirements`
@ 2026-10-11 13:39 Gary Guo
  2026-10-11 23:30 ` Gary Guo
  0 siblings, 1 reply; 2+ messages in thread
From: Gary Guo @ 2026-10-11 13:39 UTC (permalink / raw)
  To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan
  Cc: rust-for-linux, linux-kernel

From: Gary Guo <gary@garyguo.net>

`#[pin_data]` inserts outlive bounds between lifetimes to allow closure
callbacks to rely on their relationship. In some cases, these relations are
implied by fields, and Rust generates `explicit_outlives_requirements`
allow-by-default lint, which is turned out by kernel as part of
rust-2018-idioms lint group.

As `#[pin_data]` is a proc macro and it cannot know if the bounds are
already implied, suppress such lints for generated code.

Signed-off-by: Gary Guo <gary@garyguo.net>
---
 rust/pin-init/internal/src/pin_data.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rust/pin-init/internal/src/pin_data.rs b/rust/pin-init/internal/src/pin_data.rs
index dbf9084bfd22..08e11128d353 100644
--- a/rust/pin-init/internal/src/pin_data.rs
+++ b/rust/pin-init/internal/src/pin_data.rs
@@ -1792,13 +1792,13 @@ fn generate_projections(info: &StructInfo) -> TokenStream {
         #[doc = #docs]
         // Allow `non_snake_case` since the same warning will be emitted on
         // the struct definition.
-        #[allow(dead_code, non_snake_case)]
+        #[allow(dead_code, non_snake_case, explicit_outlives_requirements)]
         #[doc(hidden)]
         #projection_lt_def
 
         // Allow `non_snake_case` since the same warning will be emitted on
         // the struct definition.
-        #[allow(dead_code, non_snake_case)]
+        #[allow(dead_code, non_snake_case, explicit_outlives_requirements)]
         #[doc(hidden)]
         #projection_ref_lt_def
 
@@ -2000,7 +2000,7 @@ fn generate_the_pin_data(info: &StructInfo) -> TokenStream {
     quote! {
         // We declare this struct which will host all of the projection function for our type.
         #[doc(hidden)]
-        #[allow(non_snake_case)]
+        #[allow(non_snake_case, explicit_outlives_requirements)]
         #vis struct __PinDataLt #generics_with_field_lt
             #whr_with_field_lt
         {

base-commit: 73cf61724648ad57dd5664a0e2915e20fd304650
-- 
2.54.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rust: pin-init: internal: suppress `explicit_outlives_requirements`
  2026-10-11 13:39 [PATCH] rust: pin-init: internal: suppress `explicit_outlives_requirements` Gary Guo
@ 2026-10-11 23:30 ` Gary Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Gary Guo @ 2026-10-11 23:30 UTC (permalink / raw)
  To: Gary Guo, Benno Lossin, Miguel Ojeda, Boqun Feng,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan
  Cc: rust-for-linux, linux-kernel

On Sun Oct 11, 2026 at 2:39 PM BST, Gary Guo wrote:
> From: Gary Guo <gary@garyguo.net>
>
> `#[pin_data]` inserts outlive bounds between lifetimes to allow closure
> callbacks to rely on their relationship. In some cases, these relations are
> implied by fields, and Rust generates `explicit_outlives_requirements`
> allow-by-default lint, which is turned out by kernel as part of
> rust-2018-idioms lint group.
>
> As `#[pin_data]` is a proc macro and it cannot know if the bounds are
> already implied, suppress such lints for generated code.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>

Applied to pin-init-next early, so it gets picked up by Monday's linux-next.

Tags are still welcome.

Best,
Gary

> ---
>  rust/pin-init/internal/src/pin_data.rs | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-11 23:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 13:39 [PATCH] rust: pin-init: internal: suppress `explicit_outlives_requirements` Gary Guo
2026-10-11 23:30 ` Gary Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®