rust: pin-init: internal: suppress `explicit_outlives_requirements`
Subsystems (2)
PATCH 1/1 rust: pin-init: internal: suppress `explicit_outlives_requirements`
From: Gary Guo <[email protected]>
#[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.
--- rust/pin-init/internal/src/pin_data.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
rust/pin-init/internal/src/pin_data.rs +3 -3
@@ -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)] #visstruct __PinDataLt #generics_with_field_lt #whr_with_field_lt {
base-commit: 73cf61724648ad57dd5664a0e2915e20fd304650
Signature · 1 line
2.54.0
Quoted 8 lines · Gary Guo
From: Gary Guo <[email protected]>
#[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 generatesexplicit_outlives_requirementsallow-by-default lint, which is turned out by kernel as part of rust-2018-idioms lint group.
Quoted 4 lines
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 <[email protected]>
Applied to pin-init-next early, so it gets picked up by Monday's linux-next.
Tags are still welcome.
Best,
Gary
Quoted 3 lines
--- rust/pin-init/internal/src/pin_data.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)