The generated __drop_order_check() combines existential lifetime bounds
with inferred field outlives bounds.

For instance, for Tyr's Firmware, this places 'res: 'fw in the generic
parameter list and 'res: 'vm in the where clause, triggering Clippy's
multiple_bound_locations lint at the struct declaration.

Allow this style lint on the generated drop-order check. This preserves
all generated bounds and leaves the lint enabled for user-written code.

Cc: Gary Guo <[email protected]>
Fixes: 73cf61724648 ("rust: pin-init: internal: pin_data: support existential 
lifetimes")
Signed-off-by: Danilo Krummrich <[email protected]>
---
 rust/pin-init/internal/src/pin_data.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rust/pin-init/internal/src/pin_data.rs 
b/rust/pin-init/internal/src/pin_data.rs
index 08e11128d353..b3c487999270 100644
--- a/rust/pin-init/internal/src/pin_data.rs
+++ b/rust/pin-init/internal/src/pin_data.rs
@@ -1246,7 +1246,8 @@ fn generate_drop_order_check(dcx: &mut DiagCtxt, info: 
&StructInfo) -> TokenStre
 
     let struct_span = struct_name.span().resolved_at(Span::mixed_site());
     quote_spanned! {struct_span =>
-        #[allow(non_snake_case, unused)]
+        // Generated bounds can appear both on lifetime parameters and in the 
where clause.
+        #[allow(non_snake_case, unused, clippy::multiple_bound_locations)]
         fn __drop_order_check #impl_generics_with_field_lt (
             // This must be present so the function can *assume* the implied 
bounds on the erased
             // struct. For example, if the struct has `&'a T`, Rust will infer 
`T: 'a`; we still
-- 
2.56.1

Reply via email to