aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-16 13:14:48 +0000
committerGitHub <[email protected]>2021-03-16 13:14:48 +0000
commitc49b5b7468a9954af86fd1724276261f396aba5d (patch)
treef9b9126cd0cc9a2829de3cdb20f681b354fbe67b /crates/syntax/src/ast.rs
parent1a82af3527e476d52410ff4dfd2fb4c57466abcb (diff)
parentf5a81ec4683613bd62624811733345d627f2127b (diff)
Merge #7498
7498: Clone for update r=matklad a=matklad rowan counterpart https://github.com/rust-analyzer/rowan/pull/93 #6857 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/syntax/src/ast.rs')
-rw-r--r--crates/syntax/src/ast.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/syntax/src/ast.rs b/crates/syntax/src/ast.rs
index b3a24d39d..19261686c 100644
--- a/crates/syntax/src/ast.rs
+++ b/crates/syntax/src/ast.rs
@@ -6,6 +6,7 @@ mod token_ext;
6mod node_ext; 6mod node_ext;
7mod expr_ext; 7mod expr_ext;
8pub mod edit; 8pub mod edit;
9pub mod edit_in_place;
9pub mod make; 10pub mod make;
10 11
11use std::marker::PhantomData; 12use std::marker::PhantomData;
@@ -40,6 +41,12 @@ pub trait AstNode {
40 Self: Sized; 41 Self: Sized;
41 42
42 fn syntax(&self) -> &SyntaxNode; 43 fn syntax(&self) -> &SyntaxNode;
44 fn clone_for_update(&self) -> Self
45 where
46 Self: Sized,
47 {
48 Self::cast(self.syntax().clone_for_update()).unwrap()
49 }
43} 50}
44 51
45/// Like `AstNode`, but wraps tokens rather than interior nodes. 52/// Like `AstNode`, but wraps tokens rather than interior nodes.