Merge pull request #20624 from A4-Tacks/fix-syn-lifetime-bounds
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run

Fix LifetimeParam::lifetime_bounds invalid implement
This commit is contained in:
Chayim Refael Friedman 2025-09-09 07:35:19 +00:00 committed by GitHub
commit 6da1ce7869
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,8 +12,8 @@ use rowan::{GreenNodeData, GreenTokenData};
use crate::{
NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, T, TokenText,
ast::{
self, AstNode, AstToken, HasAttrs, HasGenericArgs, HasGenericParams, HasName, SyntaxNode,
support,
self, AstNode, AstToken, HasAttrs, HasGenericArgs, HasGenericParams, HasName,
HasTypeBounds, SyntaxNode, support,
},
ted,
};
@ -912,11 +912,10 @@ impl ast::Visibility {
impl ast::LifetimeParam {
pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> {
self.syntax()
.children_with_tokens()
.filter_map(|it| it.into_token())
.skip_while(|x| x.kind() != T![:])
.filter(|it| it.kind() == T![lifetime_ident])
self.type_bound_list()
.into_iter()
.flat_map(|it| it.bounds())
.filter_map(|it| it.lifetime()?.lifetime_ident_token())
}
}