aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-24 23:10:09 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-24 23:10:09 +0000
commit1d4b421aad0bbcd26d88e65b28dbbb4efb51d155 (patch)
tree208ef11f02ece45bae737cd63f3132006ee418c2 /crates/ra_syntax/src/ast.rs
parentc42db0bbd750fae19a91f0a0354240ea6c3bafce (diff)
parent2e354f480b0b83debc06a4311a9709cd8c0df305 (diff)
Merge #633
633: use ToOwned trait instead of inherent method r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r--crates/ra_syntax/src/ast.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index fd65264b2..165b308d1 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -15,12 +15,13 @@ use crate::{
15/// conversion itself has zero runtime cost: ast and syntax nodes have exactly 15/// conversion itself has zero runtime cost: ast and syntax nodes have exactly
16/// the same representation: a pointer to the tree root and a pointer to the 16/// the same representation: a pointer to the tree root and a pointer to the
17/// node itself. 17/// node itself.
18pub trait AstNode: rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> { 18pub trait AstNode:
19 rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> + ToOwned<Owned = TreeArc<Self>>
20{
19 fn cast(syntax: &SyntaxNode) -> Option<&Self> 21 fn cast(syntax: &SyntaxNode) -> Option<&Self>
20 where 22 where
21 Self: Sized; 23 Self: Sized;
22 fn syntax(&self) -> &SyntaxNode; 24 fn syntax(&self) -> &SyntaxNode;
23 fn to_owned(&self) -> TreeArc<Self>;
24} 25}
25 26
26pub trait AstToken: AstNode { 27pub trait AstToken: AstNode {