1616/// The lint here suggests to declare such lifetime bounds in the hope that
1717/// the unsoundness is avoided.
1818///
19- /// There is also a reverse lint that suggest to remove lifetime bounds
19+ /// There is also a reverse lint that suggests to remove lifetime bounds
2020/// that are implied by nested references. This reverse lint is intended to be used only
2121/// when the compiler has been fixed to handle these lifetime bounds correctly.
2222use std:: collections:: btree_map:: Entry ;
@@ -40,7 +40,7 @@ use rustc_hash::FxHashMap;
4040declare_clippy_lint ! {
4141 /// ### What it does
4242 /// Checks for nested references with declared generic lifetimes
43- /// in function arguments and return values and in implementation blocks .
43+ /// in function arguments and return values and in trait implementation declarations .
4444 /// Such a nested reference implies a lifetimes bound because the inner reference must
4545 /// outlive the outer reference.
4646 ///
@@ -97,7 +97,7 @@ declare_clippy_lint! {
9797declare_clippy_lint ! {
9898 /// ### What it does
9999 /// Checks for nested references with declared generic lifetimes
100- /// in function arguments and return values and in implementation blocks .
100+ /// in function arguments and return values and in trait implementation declarations .
101101 /// Such a nested reference implies a lifetimes bound because the inner reference must
102102 /// outlive the outer reference.
103103 ///
@@ -147,10 +147,10 @@ impl_lint_pass!(LifetimesBoundNestedRef => [
147147] ) ;
148148
149149impl EarlyLintPass for LifetimesBoundNestedRef {
150- /// For issue 25860: from function arguments and return values ,
151- /// get declared lifetimes and declared lifetime bounds,
152- /// and compare these with lifetime bounds implied by nested references
153- /// in the function signature .
150+ /// For issue 25860: from the generic arguments of a function ,
151+ /// get the declared lifetimes and the declared lifetime bounds.
152+ /// Compare these with lifetime bounds implied by nested references
153+ /// in the function arguments and return value .
154154 fn check_fn ( & mut self , early_context : & EarlyContext < ' _ > , fn_kind : FnKind < ' _ > , _fn_span : Span , _node_id : NodeId ) {
155155 let FnKind :: Fn ( _fn_ctxt, _ident, fn_sig, _visibility, generics, _opt_block) = fn_kind else {
156156 return ;
@@ -170,12 +170,13 @@ impl EarlyLintPass for LifetimesBoundNestedRef {
170170 }
171171
172172 /// For issues 84591 and 100051:
173- /// Get declared lifetimes and declared lifetime bounds,
174- /// and compare these with lifetime bounds implied by nested references
175- /// in a trait implementation declaration.
173+ /// From the generic arguments of a trait implementation declaration
174+ /// get the declared lifetimes and the declared lifetime bounds.
175+ /// Compare these with lifetime bounds implied by nested references
176+ /// in the trait implementation declaration.
176177 ///
177- /// For issue 100051 also check for nested references in the `for` projection: `impl ... for
178- /// ...` .
178+ /// For issue 100051 also check for nested references
179+ /// in the `for` projection: `impl ... for ...` .
179180 fn check_item_post ( & mut self , early_context : & EarlyContext < ' _ > , item : & Item ) {
180181 let ItemKind :: Impl ( box_impl) = & item. kind else {
181182 return ;
@@ -196,7 +197,7 @@ impl EarlyLintPass for LifetimesBoundNestedRef {
196197 }
197198}
198199
199- /// A lifetime bound between a pair of lifetime symbols,
200+ /// A lifetimes bound between a pair of lifetime symbols,
200201/// e.g. 'long: 'outlived.
201202#[ derive( Debug , PartialEq , Eq , PartialOrd , Ord ) ] // use lexicographic ordering
202203struct BoundLftSymbolPair {
@@ -455,7 +456,7 @@ impl ImpliedBoundsLinter {
455456 } ,
456457 Entry :: Occupied ( mut prev_entry) => {
457458 // keep the first occurring spans for the nested reference.
458- // (the actual insertion order here depends on the recursion order)
459+ // (the insertion order here depends on the recursion order on the input types. )
459460 let prev_spans = prev_entry. get_mut ( ) ;
460461 if ( outlived_lft_ident. span < prev_spans. 0 )
461462 || ( outlived_lft_ident. span == prev_spans. 0 && ( long_lft_ident. span < prev_spans. 1 ) )
0 commit comments