Skip to content

Commit 080f2b3

Browse files
committed
Fix LifetimeParam::lifetime_bounds invalid implement
Lifetime node example: ``` [email protected] [email protected] [email protected] "'a" [email protected] ":" [email protected] " " [email protected] [email protected] [email protected] [email protected] "'b" ```
1 parent 1f4e5e8 commit 080f2b3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crates/syntax/src/ast/node_ext.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use rowan::{GreenNodeData, GreenTokenData};
1212
use crate::{
1313
NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, T, TokenText,
1414
ast::{
15-
self, AstNode, AstToken, HasAttrs, HasGenericArgs, HasGenericParams, HasName, SyntaxNode,
16-
support,
15+
self, AstNode, AstToken, HasAttrs, HasGenericArgs, HasGenericParams, HasName,
16+
HasTypeBounds, SyntaxNode, support,
1717
},
1818
ted,
1919
};
@@ -912,11 +912,10 @@ impl ast::Visibility {
912912

913913
impl ast::LifetimeParam {
914914
pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> {
915-
self.syntax()
916-
.children_with_tokens()
917-
.filter_map(|it| it.into_token())
918-
.skip_while(|x| x.kind() != T![:])
919-
.filter(|it| it.kind() == T![lifetime_ident])
915+
self.type_bound_list()
916+
.into_iter()
917+
.flat_map(|it| it.bounds())
918+
.filter_map(|it| it.lifetime()?.lifetime_ident_token())
920919
}
921920
}
922921

0 commit comments

Comments
 (0)