mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 02:06:57 +00:00
Parse generic consts
A lang team experiment, https://github.com/rust-lang/rust/issues/113521.
This commit is contained in:
parent
2f2cff19f8
commit
812a035689
12 changed files with 305 additions and 3 deletions
|
|
@ -405,6 +405,7 @@ pub struct Const {
|
|||
}
|
||||
impl ast::HasAttrs for Const {}
|
||||
impl ast::HasDocComments for Const {}
|
||||
impl ast::HasGenericParams for Const {}
|
||||
impl ast::HasName for Const {}
|
||||
impl ast::HasVisibility for Const {}
|
||||
impl Const {
|
||||
|
|
@ -9421,7 +9422,7 @@ impl ast::HasGenericParams for AnyHasGenericParams {}
|
|||
impl AstNode for AnyHasGenericParams {
|
||||
#[inline]
|
||||
fn can_cast(kind: SyntaxKind) -> bool {
|
||||
matches!(kind, ENUM | FN | IMPL | STRUCT | TRAIT | TRAIT_ALIAS | TYPE_ALIAS | UNION)
|
||||
matches!(kind, CONST | ENUM | FN | IMPL | STRUCT | TRAIT | TRAIT_ALIAS | TYPE_ALIAS | UNION)
|
||||
}
|
||||
#[inline]
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
|
|
@ -9445,6 +9446,10 @@ impl fmt::Debug for AnyHasGenericParams {
|
|||
f.debug_struct("AnyHasGenericParams").field("syntax", &self.syntax).finish()
|
||||
}
|
||||
}
|
||||
impl From<Const> for AnyHasGenericParams {
|
||||
#[inline]
|
||||
fn from(node: Const) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
|
||||
}
|
||||
impl From<Enum> for AnyHasGenericParams {
|
||||
#[inline]
|
||||
fn from(node: Enum) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue