diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2022-11-01 11:31:31 +0200 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2022-11-01 11:31:31 +0200 |
| commit | 0b3e75e1cdc8d56fc5540e17450d96228b26e268 (patch) | |
| tree | ba2f1ca144b5dcfa25847ad79acc642691b0b34f /src/tools/rust-analyzer/crates/syntax | |
| parent | dc05f60c1ff4e2cb2e6eb80c9b3afa612ce28c7f (diff) | |
| parent | ba28e19b7838e3ad4223ae82d074dc3950ef1548 (diff) | |
:arrow_up: rust-analyzer
Diffstat (limited to 'src/tools/rust-analyzer/crates/syntax')
| -rw-r--r-- | src/tools/rust-analyzer/crates/syntax/rust.ungram | 2 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs | 54 |
2 files changed, 28 insertions, 28 deletions
diff --git a/src/tools/rust-analyzer/crates/syntax/rust.ungram b/src/tools/rust-analyzer/crates/syntax/rust.ungram index 89479543545..5379732ac6c 100644 --- a/src/tools/rust-analyzer/crates/syntax/rust.ungram +++ b/src/tools/rust-analyzer/crates/syntax/rust.ungram @@ -51,7 +51,7 @@ TypeArg = Type AssocTypeArg = - NameRef GenericParamList? (':' TypeBoundList | ('=' Type | ConstArg)) + NameRef GenericArgList? (':' TypeBoundList | ('=' Type | ConstArg)) LifetimeArg = Lifetime diff --git a/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs b/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs index 449402e5f5b..6cfb98d92fc 100644 --- a/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs +++ b/src/tools/rust-analyzer/crates/syntax/src/ast/generated/nodes.rs @@ -120,7 +120,7 @@ pub struct AssocTypeArg { impl ast::HasTypeBounds for AssocTypeArg {} impl AssocTypeArg { pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } - pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } + pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } pub fn const_arg(&self) -> Option<ConstArg> { support::child(&self.syntax) } @@ -143,16 +143,6 @@ impl ConstArg { } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct GenericParamList { - pub(crate) syntax: SyntaxNode, -} -impl GenericParamList { - pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } - pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } - pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeBoundList { pub(crate) syntax: SyntaxNode, } @@ -528,6 +518,16 @@ impl Abi { } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct GenericParamList { + pub(crate) syntax: SyntaxNode, +} +impl GenericParamList { + pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } + pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } + pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WhereClause { pub(crate) syntax: SyntaxNode, } @@ -1834,17 +1834,6 @@ impl AstNode for ConstArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for GenericParamList { - fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } - fn cast(syntax: SyntaxNode) -> Option<Self> { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} impl AstNode for TypeBoundList { fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { @@ -2153,6 +2142,17 @@ impl AstNode for Abi { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl AstNode for GenericParamList { + fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } + fn cast(syntax: SyntaxNode) -> Option<Self> { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} impl AstNode for WhereClause { fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } fn cast(syntax: SyntaxNode) -> Option<Self> { @@ -4263,11 +4263,6 @@ impl std::fmt::Display for ConstArg { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for GenericParamList { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for TypeBoundList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -4408,6 +4403,11 @@ impl std::fmt::Display for Abi { std::fmt::Display::fmt(self.syntax(), f) } } +impl std::fmt::Display for GenericParamList { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for WhereClause { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) |
