Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast.rs')
-rw-r--r--crates/syntax/src/ast.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/syntax/src/ast.rs b/crates/syntax/src/ast.rs
index 32b1f5f754..72a46f2f9f 100644
--- a/crates/syntax/src/ast.rs
+++ b/crates/syntax/src/ast.rs
@@ -42,6 +42,14 @@ pub use self::{
/// the same representation: a pointer to the tree root and a pointer to the
/// node itself.
pub trait AstNode {
+ /// This panics if the `SyntaxKind` is not statically known.
+ fn kind() -> SyntaxKind
+ where
+ Self: Sized,
+ {
+ panic!("dynamic `SyntaxKind` for `AstNode::kind()`")
+ }
+
fn can_cast(kind: SyntaxKind) -> bool
where
Self: Sized;