aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_cli/src/main.rs4
-rw-r--r--crates/ra_db/src/lib.rs6
-rw-r--r--crates/ra_db/src/syntax_ptr.rs4
-rw-r--r--crates/ra_hir/src/code_model_api.rs18
-rw-r--r--crates/ra_hir/src/code_model_impl/function.rs4
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs6
-rw-r--r--crates/ra_hir/src/db.rs6
-rw-r--r--crates/ra_hir/src/ids.rs10
-rw-r--r--crates/ra_hir/src/macros.rs6
-rw-r--r--crates/ra_hir/src/module_tree.rs6
-rw-r--r--crates/ra_hir/src/query_definitions.rs4
-rw-r--r--crates/ra_ide_api/src/hover.rs4
-rw-r--r--crates/ra_ide_api/src/lib.rs4
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs4
-rw-r--r--crates/ra_syntax/Cargo.toml2
-rw-r--r--crates/ra_syntax/src/ast.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated.rs226
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera6
-rw-r--r--crates/ra_syntax/src/lib.rs14
-rw-r--r--crates/ra_syntax/src/validation/byte.rs4
-rw-r--r--crates/ra_syntax/src/validation/byte_string.rs4
-rw-r--r--crates/ra_syntax/src/validation/char.rs4
-rw-r--r--crates/ra_syntax/src/validation/string.rs4
-rw-r--r--crates/ra_syntax/src/yellow.rs34
24 files changed, 194 insertions, 194 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index 43fb2fc4c..6b5be27be 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -3,7 +3,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
3use clap::{App, Arg, SubCommand}; 3use clap::{App, Arg, SubCommand};
4use join_to_string::join; 4use join_to_string::join;
5use ra_ide_api_light::{extend_selection, file_structure, syntax_tree}; 5use ra_ide_api_light::{extend_selection, file_structure, syntax_tree};
6use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode}; 6use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode};
7use tools::collect_tests; 7use tools::collect_tests;
8 8
9type Result<T> = ::std::result::Result<T, failure::Error>; 9type Result<T> = ::std::result::Result<T, failure::Error>;
@@ -71,7 +71,7 @@ fn main() -> Result<()> {
71 Ok(()) 71 Ok(())
72} 72}
73 73
74fn file() -> Result<TreePtr<SourceFile>> { 74fn file() -> Result<TreeArc<SourceFile>> {
75 let text = read_stdin()?; 75 let text = read_stdin()?;
76 Ok(SourceFile::parse(&text)) 76 Ok(SourceFile::parse(&text))
77} 77}
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index 20e712afe..0c4dfc8c6 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -7,7 +7,7 @@ pub mod mock;
7 7
8use std::panic; 8use std::panic;
9 9
10use ra_syntax::{TextUnit, TextRange, SourceFile, TreePtr}; 10use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc};
11 11
12pub use crate::{ 12pub use crate::{
13 cancellation::{Canceled, Cancelable}, 13 cancellation::{Canceled, Cancelable},
@@ -40,13 +40,13 @@ pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe {
40 40
41salsa::query_group! { 41salsa::query_group! {
42 pub trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase { 42 pub trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase {
43 fn source_file(file_id: FileId) -> TreePtr<SourceFile> { 43 fn source_file(file_id: FileId) -> TreeArc<SourceFile> {
44 type SourceFileQuery; 44 type SourceFileQuery;
45 } 45 }
46 } 46 }
47} 47}
48 48
49fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreePtr<SourceFile> { 49fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreeArc<SourceFile> {
50 let text = db.file_text(file_id); 50 let text = db.file_text(file_id);
51 SourceFile::parse(&*text) 51 SourceFile::parse(&*text)
52} 52}
diff --git a/crates/ra_db/src/syntax_ptr.rs b/crates/ra_db/src/syntax_ptr.rs
index be64d417c..5270826da 100644
--- a/crates/ra_db/src/syntax_ptr.rs
+++ b/crates/ra_db/src/syntax_ptr.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TreePtr}; 1use ra_syntax::{AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TreeArc};
2 2
3/// A pointer to a syntax node inside a file. 3/// A pointer to a syntax node inside a file.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -15,7 +15,7 @@ impl LocalSyntaxPtr {
15 } 15 }
16 } 16 }
17 17
18 pub fn resolve(self, file: &SourceFile) -> TreePtr<SyntaxNode> { 18 pub fn resolve(self, file: &SourceFile) -> TreeArc<SyntaxNode> {
19 let mut curr = file.syntax(); 19 let mut curr = file.syntax();
20 loop { 20 loop {
21 if curr.range() == self.range && curr.kind() == self.kind { 21 if curr.range() == self.range && curr.kind() == self.kind {
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 8ec6b9b2b..098c7f40b 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
2 2
3use relative_path::RelativePathBuf; 3use relative_path::RelativePathBuf;
4use ra_db::{CrateId, Cancelable, FileId}; 4use ra_db::{CrateId, Cancelable, FileId};
5use ra_syntax::{ast, TreePtr, SyntaxNode, AstNode}; 5use ra_syntax::{ast, TreeArc, SyntaxNode, AstNode};
6 6
7use crate::{ 7use crate::{
8 Name, DefId, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId, 8 Name, DefId, Path, PerNs, ScopesWithSyntaxMapping, Ty, HirFileId,
@@ -55,8 +55,8 @@ pub struct Module {
55} 55}
56 56
57pub enum ModuleSource { 57pub enum ModuleSource {
58 SourceFile(TreePtr<ast::SourceFile>), 58 SourceFile(TreeArc<ast::SourceFile>),
59 Module(TreePtr<ast::Module>), 59 Module(TreeArc<ast::Module>),
60} 60}
61 61
62#[derive(Clone, Debug, Hash, PartialEq, Eq)] 62#[derive(Clone, Debug, Hash, PartialEq, Eq)]
@@ -86,7 +86,7 @@ impl Module {
86 pub fn declaration_source( 86 pub fn declaration_source(
87 &self, 87 &self,
88 db: &impl HirDatabase, 88 db: &impl HirDatabase,
89 ) -> Cancelable<Option<(FileId, TreePtr<ast::Module>)>> { 89 ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> {
90 self.declaration_source_impl(db) 90 self.declaration_source_impl(db)
91 } 91 }
92 92
@@ -134,7 +134,7 @@ impl Module {
134 pub fn problems( 134 pub fn problems(
135 &self, 135 &self,
136 db: &impl HirDatabase, 136 db: &impl HirDatabase,
137 ) -> Cancelable<Vec<(TreePtr<SyntaxNode>, Problem)>> { 137 ) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> {
138 self.problems_impl(db) 138 self.problems_impl(db)
139 } 139 }
140} 140}
@@ -185,7 +185,7 @@ impl Struct {
185 pub fn source( 185 pub fn source(
186 &self, 186 &self,
187 db: &impl HirDatabase, 187 db: &impl HirDatabase,
188 ) -> Cancelable<(HirFileId, TreePtr<ast::StructDef>)> { 188 ) -> Cancelable<(HirFileId, TreeArc<ast::StructDef>)> {
189 let (file_id, syntax) = self.def_id.source(db); 189 let (file_id, syntax) = self.def_id.source(db);
190 Ok(( 190 Ok((
191 file_id, 191 file_id,
@@ -218,7 +218,7 @@ impl Enum {
218 Ok(db.enum_data(self.def_id)?.variants.clone()) 218 Ok(db.enum_data(self.def_id)?.variants.clone())
219 } 219 }
220 220
221 pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreePtr<ast::EnumDef>)> { 221 pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::EnumDef>)> {
222 let (file_id, syntax) = self.def_id.source(db); 222 let (file_id, syntax) = self.def_id.source(db);
223 Ok(( 223 Ok((
224 file_id, 224 file_id,
@@ -258,7 +258,7 @@ impl EnumVariant {
258 pub fn source( 258 pub fn source(
259 &self, 259 &self,
260 db: &impl HirDatabase, 260 db: &impl HirDatabase,
261 ) -> Cancelable<(HirFileId, TreePtr<ast::EnumVariant>)> { 261 ) -> Cancelable<(HirFileId, TreeArc<ast::EnumVariant>)> {
262 let (file_id, syntax) = self.def_id.source(db); 262 let (file_id, syntax) = self.def_id.source(db);
263 Ok(( 263 Ok((
264 file_id, 264 file_id,
@@ -303,7 +303,7 @@ impl Function {
303 self.def_id 303 self.def_id
304 } 304 }
305 305
306 pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreePtr<ast::FnDef>)> { 306 pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::FnDef>)> {
307 Ok(self.source_impl(db)) 307 Ok(self.source_impl(db))
308 } 308 }
309 309
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs
index 009175bab..daf49e791 100644
--- a/crates/ra_hir/src/code_model_impl/function.rs
+++ b/crates/ra_hir/src/code_model_impl/function.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
4 4
5use ra_db::Cancelable; 5use ra_db::Cancelable;
6use ra_syntax::{ 6use ra_syntax::{
7 TreePtr, 7 TreeArc,
8 ast::{self, AstNode, NameOwner}, 8 ast::{self, AstNode, NameOwner},
9}; 9};
10 10
@@ -22,7 +22,7 @@ impl Function {
22 Function { def_id } 22 Function { def_id }
23 } 23 }
24 24
25 pub(crate) fn source_impl(&self, db: &impl HirDatabase) -> (HirFileId, TreePtr<ast::FnDef>) { 25 pub(crate) fn source_impl(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::FnDef>) {
26 let def_loc = self.def_id.loc(db); 26 let def_loc = self.def_id.loc(db);
27 assert!(def_loc.kind == DefKind::Function); 27 assert!(def_loc.kind == DefKind::Function);
28 let syntax = db.file_item(def_loc.source_item_id); 28 let syntax = db.file_item(def_loc.source_item_id);
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 878dc37c8..e9ff06dc8 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -1,5 +1,5 @@
1use ra_db::{Cancelable, SourceRootId, FileId}; 1use ra_db::{Cancelable, SourceRootId, FileId};
2use ra_syntax::{ast, SyntaxNode, AstNode, TreePtr}; 2use ra_syntax::{ast, SyntaxNode, AstNode, TreeArc};
3 3
4use crate::{ 4use crate::{
5 Module, ModuleSource, Problem, 5 Module, ModuleSource, Problem,
@@ -57,7 +57,7 @@ impl Module {
57 pub fn declaration_source_impl( 57 pub fn declaration_source_impl(
58 &self, 58 &self,
59 db: &impl HirDatabase, 59 db: &impl HirDatabase,
60 ) -> Cancelable<Option<(FileId, TreePtr<ast::Module>)>> { 60 ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> {
61 let loc = self.def_id.loc(db); 61 let loc = self.def_id.loc(db);
62 let module_tree = db.module_tree(loc.source_root_id)?; 62 let module_tree = db.module_tree(loc.source_root_id)?;
63 let link = ctry!(loc.module_id.parent_link(&module_tree)); 63 let link = ctry!(loc.module_id.parent_link(&module_tree));
@@ -173,7 +173,7 @@ impl Module {
173 pub fn problems_impl( 173 pub fn problems_impl(
174 &self, 174 &self,
175 db: &impl HirDatabase, 175 db: &impl HirDatabase,
176 ) -> Cancelable<Vec<(TreePtr<SyntaxNode>, Problem)>> { 176 ) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> {
177 let loc = self.def_id.loc(db); 177 let loc = self.def_id.loc(db);
178 let module_tree = db.module_tree(loc.source_root_id)?; 178 let module_tree = db.module_tree(loc.source_root_id)?;
179 Ok(loc.module_id.problems(&module_tree, db)) 179 Ok(loc.module_id.problems(&module_tree, db))
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 9a6ef8083..a11c73db0 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -1,6 +1,6 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use ra_syntax::{SyntaxNode, TreePtr, SourceFile}; 3use ra_syntax::{SyntaxNode, TreeArc, SourceFile};
4use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, Cancelable}; 4use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, Cancelable};
5 5
6use crate::{ 6use crate::{
@@ -22,7 +22,7 @@ pub trait HirDatabase: SyntaxDatabase
22 + AsRef<LocationIntener<DefLoc, DefId>> 22 + AsRef<LocationIntener<DefLoc, DefId>>
23 + AsRef<LocationIntener<MacroCallLoc, MacroCallId>> 23 + AsRef<LocationIntener<MacroCallLoc, MacroCallId>>
24{ 24{
25 fn hir_source_file(file_id: HirFileId) -> TreePtr<SourceFile> { 25 fn hir_source_file(file_id: HirFileId) -> TreeArc<SourceFile> {
26 type HirSourceFileQuery; 26 type HirSourceFileQuery;
27 use fn HirFileId::hir_source_file; 27 use fn HirFileId::hir_source_file;
28 } 28 }
@@ -72,7 +72,7 @@ pub trait HirDatabase: SyntaxDatabase
72 use fn query_definitions::file_items; 72 use fn query_definitions::file_items;
73 } 73 }
74 74
75 fn file_item(source_item_id: SourceItemId) -> TreePtr<SyntaxNode> { 75 fn file_item(source_item_id: SourceItemId) -> TreeArc<SyntaxNode> {
76 type FileItemQuery; 76 type FileItemQuery;
77 use fn query_definitions::file_item; 77 use fn query_definitions::file_item;
78 } 78 }
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index c75ef4ae7..0805fd3db 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -1,5 +1,5 @@
1use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; 1use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId};
2use ra_syntax::{TreePtr, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast}; 2use ra_syntax::{TreeArc, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast};
3use ra_arena::{Arena, RawId, impl_arena_id}; 3use ra_arena::{Arena, RawId, impl_arena_id};
4 4
5use crate::{ 5use crate::{
@@ -61,7 +61,7 @@ impl HirFileId {
61 pub(crate) fn hir_source_file( 61 pub(crate) fn hir_source_file(
62 db: &impl HirDatabase, 62 db: &impl HirDatabase,
63 file_id: HirFileId, 63 file_id: HirFileId,
64 ) -> TreePtr<SourceFile> { 64 ) -> TreeArc<SourceFile> {
65 match file_id.0 { 65 match file_id.0 {
66 HirFileIdRepr::File(file_id) => db.source_file(file_id), 66 HirFileIdRepr::File(file_id) => db.source_file(file_id),
67 HirFileIdRepr::Macro(m) => { 67 HirFileIdRepr::Macro(m) => {
@@ -179,7 +179,7 @@ impl DefId {
179 Ok(res) 179 Ok(res)
180 } 180 }
181 181
182 pub(crate) fn source(self, db: &impl HirDatabase) -> (HirFileId, TreePtr<SyntaxNode>) { 182 pub(crate) fn source(self, db: &impl HirDatabase) -> (HirFileId, TreeArc<SyntaxNode>) {
183 let loc = self.loc(db); 183 let loc = self.loc(db);
184 let syntax = db.file_item(loc.source_item_id); 184 let syntax = db.file_item(loc.source_item_id);
185 (loc.source_item_id.file_id, syntax) 185 (loc.source_item_id.file_id, syntax)
@@ -244,7 +244,7 @@ pub struct SourceItemId {
244#[derive(Debug, PartialEq, Eq)] 244#[derive(Debug, PartialEq, Eq)]
245pub struct SourceFileItems { 245pub struct SourceFileItems {
246 file_id: HirFileId, 246 file_id: HirFileId,
247 arena: Arena<SourceFileItemId, TreePtr<SyntaxNode>>, 247 arena: Arena<SourceFileItemId, TreeArc<SyntaxNode>>,
248} 248}
249 249
250impl SourceFileItems { 250impl SourceFileItems {
@@ -273,7 +273,7 @@ impl SourceFileItems {
273 }) 273 })
274 } 274 }
275 275
276 fn alloc(&mut self, item: TreePtr<SyntaxNode>) -> SourceFileItemId { 276 fn alloc(&mut self, item: TreeArc<SyntaxNode>) -> SourceFileItemId {
277 self.arena.alloc(item) 277 self.arena.alloc(item)
278 } 278 }
279 pub(crate) fn id_of(&self, file_id: HirFileId, item: &SyntaxNode) -> SourceFileItemId { 279 pub(crate) fn id_of(&self, file_id: HirFileId, item: &SyntaxNode) -> SourceFileItemId {
diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs
index e455b2ad5..220bee94e 100644
--- a/crates/ra_hir/src/macros.rs
+++ b/crates/ra_hir/src/macros.rs
@@ -11,7 +11,7 @@ use std::sync::Arc;
11 11
12use ra_db::LocalSyntaxPtr; 12use ra_db::LocalSyntaxPtr;
13use ra_syntax::{ 13use ra_syntax::{
14 TextRange, TextUnit, SourceFile, AstNode, SyntaxNode, TreePtr, 14 TextRange, TextUnit, SourceFile, AstNode, SyntaxNode, TreeArc,
15 ast::{self, NameOwner}, 15 ast::{self, NameOwner},
16}; 16};
17 17
@@ -152,11 +152,11 @@ pub struct MacroExpansion {
152impl MacroExpansion { 152impl MacroExpansion {
153 // FIXME: does not really make sense, macro expansion is not neccessary a 153 // FIXME: does not really make sense, macro expansion is not neccessary a
154 // whole file. See `MacroExpansion::ptr` as well. 154 // whole file. See `MacroExpansion::ptr` as well.
155 pub(crate) fn file(&self) -> TreePtr<SourceFile> { 155 pub(crate) fn file(&self) -> TreeArc<SourceFile> {
156 SourceFile::parse(&self.text) 156 SourceFile::parse(&self.text)
157 } 157 }
158 158
159 pub fn syntax(&self) -> TreePtr<SyntaxNode> { 159 pub fn syntax(&self) -> TreeArc<SyntaxNode> {
160 self.ptr.resolve(&self.file()) 160 self.ptr.resolve(&self.file())
161 } 161 }
162 /// Maps range in the source code to the range in the expanded code. 162 /// Maps range in the source code to the range in the expanded code.
diff --git a/crates/ra_hir/src/module_tree.rs b/crates/ra_hir/src/module_tree.rs
index 50383c6d8..67823e970 100644
--- a/crates/ra_hir/src/module_tree.rs
+++ b/crates/ra_hir/src/module_tree.rs
@@ -5,7 +5,7 @@ use arrayvec::ArrayVec;
5use relative_path::RelativePathBuf; 5use relative_path::RelativePathBuf;
6use ra_db::{FileId, SourceRootId, Cancelable, SourceRoot}; 6use ra_db::{FileId, SourceRootId, Cancelable, SourceRoot};
7use ra_syntax::{ 7use ra_syntax::{
8 SyntaxNode, TreePtr, 8 SyntaxNode, TreeArc,
9 algo::generate, 9 algo::generate,
10 ast::{self, AstNode, NameOwner}, 10 ast::{self, AstNode, NameOwner},
11}; 11};
@@ -170,7 +170,7 @@ impl ModuleId {
170 self, 170 self,
171 tree: &ModuleTree, 171 tree: &ModuleTree,
172 db: &impl HirDatabase, 172 db: &impl HirDatabase,
173 ) -> Vec<(TreePtr<SyntaxNode>, Problem)> { 173 ) -> Vec<(TreeArc<SyntaxNode>, Problem)> {
174 tree.mods[self] 174 tree.mods[self]
175 .children 175 .children
176 .iter() 176 .iter()
@@ -191,7 +191,7 @@ impl LinkId {
191 pub(crate) fn name(self, tree: &ModuleTree) -> &Name { 191 pub(crate) fn name(self, tree: &ModuleTree) -> &Name {
192 &tree.links[self].name 192 &tree.links[self].name
193 } 193 }
194 pub(crate) fn source(self, tree: &ModuleTree, db: &impl HirDatabase) -> TreePtr<ast::Module> { 194 pub(crate) fn source(self, tree: &ModuleTree, db: &impl HirDatabase) -> TreeArc<ast::Module> {
195 let syntax_node = db.file_item(tree.links[self].source); 195 let syntax_node = db.file_item(tree.links[self].source);
196 ast::Module::cast(&syntax_node).unwrap().to_owned() 196 ast::Module::cast(&syntax_node).unwrap().to_owned()
197 } 197 }
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs
index 32be23d8c..214a9d68b 100644
--- a/crates/ra_hir/src/query_definitions.rs
+++ b/crates/ra_hir/src/query_definitions.rs
@@ -5,7 +5,7 @@ use std::{
5 5
6use rustc_hash::FxHashMap; 6use rustc_hash::FxHashMap;
7use ra_syntax::{ 7use ra_syntax::{
8 AstNode, SyntaxNode, TreePtr, 8 AstNode, SyntaxNode, TreeArc,
9 ast::{self, ModuleItemOwner} 9 ast::{self, ModuleItemOwner}
10}; 10};
11use ra_db::{SourceRootId, Cancelable,}; 11use ra_db::{SourceRootId, Cancelable,};
@@ -33,7 +33,7 @@ pub(super) fn file_items(db: &impl HirDatabase, file_id: HirFileId) -> Arc<Sourc
33pub(super) fn file_item( 33pub(super) fn file_item(
34 db: &impl HirDatabase, 34 db: &impl HirDatabase,
35 source_item_id: SourceItemId, 35 source_item_id: SourceItemId,
36) -> TreePtr<SyntaxNode> { 36) -> TreeArc<SyntaxNode> {
37 match source_item_id.item_id { 37 match source_item_id.item_id {
38 Some(id) => db.file_items(source_item_id.file_id)[id].to_owned(), 38 Some(id) => db.file_items(source_item_id.file_id)[id].to_owned(),
39 None => db 39 None => db
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index f544ffa6d..b66774cdf 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -1,6 +1,6 @@
1use ra_db::{Cancelable, SyntaxDatabase}; 1use ra_db::{Cancelable, SyntaxDatabase};
2use ra_syntax::{ 2use ra_syntax::{
3 AstNode, SyntaxNode, TreePtr, 3 AstNode, SyntaxNode, TreeArc,
4 ast::{self, NameOwner}, 4 ast::{self, NameOwner},
5 algo::{find_covering_node, find_node_at_offset, find_leaf_at_offset, visit::{visitor, Visitor}}, 5 algo::{find_covering_node, find_node_at_offset, find_leaf_at_offset, visit::{visitor, Visitor}},
6}; 6};
@@ -87,7 +87,7 @@ fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Cancelable<Option<S
87} 87}
88 88
89impl NavigationTarget { 89impl NavigationTarget {
90 fn node(&self, db: &RootDatabase) -> Option<TreePtr<SyntaxNode>> { 90 fn node(&self, db: &RootDatabase) -> Option<TreeArc<SyntaxNode>> {
91 let source_file = db.source_file(self.file_id()); 91 let source_file = db.source_file(self.file_id());
92 let source_file = source_file.syntax(); 92 let source_file = source_file.syntax();
93 let node = source_file 93 let node = source_file
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 6155d903a..abb50ff95 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -35,7 +35,7 @@ mod parent_module;
35 35
36use std::{fmt, sync::Arc}; 36use std::{fmt, sync::Arc};
37 37
38use ra_syntax::{SourceFile, TreePtr, TextRange, TextUnit}; 38use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit};
39use ra_text_edit::TextEdit; 39use ra_text_edit::TextEdit;
40use ra_db::{SyntaxDatabase, FilesDatabase, BaseDatabase}; 40use ra_db::{SyntaxDatabase, FilesDatabase, BaseDatabase};
41use rayon::prelude::*; 41use rayon::prelude::*;
@@ -303,7 +303,7 @@ impl Analysis {
303 } 303 }
304 304
305 /// Gets the syntax tree of the file. 305 /// Gets the syntax tree of the file.
306 pub fn file_syntax(&self, file_id: FileId) -> TreePtr<SourceFile> { 306 pub fn file_syntax(&self, file_id: FileId) -> TreeArc<SourceFile> {
307 self.db.source_file(file_id).clone() 307 self.db.source_file(file_id).clone()
308 } 308 }
309 309
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 8dd15b40e..fdda57022 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -27,7 +27,7 @@ use std::{
27 27
28use fst::{self, Streamer}; 28use fst::{self, Streamer};
29use ra_syntax::{ 29use ra_syntax::{
30 SyntaxNode, SourceFile, SmolStr, TreePtr, AstNode, 30 SyntaxNode, SourceFile, SmolStr, TreeArc, AstNode,
31 algo::{visit::{visitor, Visitor}, find_covering_node}, 31 algo::{visit::{visitor, Visitor}, find_covering_node},
32 SyntaxKind::{self, *}, 32 SyntaxKind::{self, *},
33 ast::{self, NameOwner}, 33 ast::{self, NameOwner},
@@ -141,7 +141,7 @@ impl SymbolIndex {
141 } 141 }
142 142
143 pub(crate) fn for_files( 143 pub(crate) fn for_files(
144 files: impl ParallelIterator<Item = (FileId, TreePtr<SourceFile>)>, 144 files: impl ParallelIterator<Item = (FileId, TreeArc<SourceFile>)>,
145 ) -> SymbolIndex { 145 ) -> SymbolIndex {
146 let symbols = files 146 let symbols = files
147 .flat_map(|(file_id, file)| { 147 .flat_map(|(file_id, file)| {
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index d5b4a4a77..77cd6c804 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -13,7 +13,7 @@ unicode-xid = "0.1.0"
13itertools = "0.8.0" 13itertools = "0.8.0"
14drop_bomb = "0.1.4" 14drop_bomb = "0.1.4"
15parking_lot = "0.7.0" 15parking_lot = "0.7.0"
16rowan = "0.2.0" 16rowan = "0.3.0"
17 17
18# ideally, `serde` should be enabled by `ra_lsp_serder`, but we enable it here 18# ideally, `serde` should be enabled by `ra_lsp_serder`, but we enable it here
19# to reduce number of compilations 19# to reduce number of compilations
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index d25b5642b..123a7a6b9 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -6,7 +6,7 @@ use itertools::Itertools;
6 6
7pub use self::generated::*; 7pub use self::generated::*;
8use crate::{ 8use crate::{
9 yellow::{SyntaxNode, SyntaxNodeChildren, TreePtr, RaTypes}, 9 yellow::{SyntaxNode, SyntaxNodeChildren, TreeArc, RaTypes},
10 SmolStr, 10 SmolStr,
11 SyntaxKind::*, 11 SyntaxKind::*,
12}; 12};
@@ -20,7 +20,7 @@ pub trait AstNode: rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>
20 where 20 where
21 Self: Sized; 21 Self: Sized;
22 fn syntax(&self) -> &SyntaxNode; 22 fn syntax(&self) -> &SyntaxNode;
23 fn to_owned(&self) -> TreePtr<Self>; 23 fn to_owned(&self) -> TreeArc<Self>;
24} 24}
25 25
26pub trait AstToken: AstNode { 26pub trait AstToken: AstNode {
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 547e3c003..1f6055115 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -13,7 +13,7 @@ use rowan::TransparentNewType;
13 13
14use crate::{ 14use crate::{
15 SyntaxNode, SyntaxKind::*, 15 SyntaxNode, SyntaxKind::*,
16 yellow::{RaTypes, TreePtr}, 16 yellow::{RaTypes, TreeArc},
17 ast::{self, AstNode}, 17 ast::{self, AstNode},
18}; 18};
19 19
@@ -35,7 +35,7 @@ impl AstNode for ArgList {
35 } 35 }
36 } 36 }
37 fn syntax(&self) -> &SyntaxNode { &self.syntax } 37 fn syntax(&self) -> &SyntaxNode { &self.syntax }
38 fn to_owned(&self) -> TreePtr<ArgList> { TreePtr::cast(self.syntax.to_owned()) } 38 fn to_owned(&self) -> TreeArc<ArgList> { TreeArc::cast(self.syntax.to_owned()) }
39} 39}
40 40
41 41
@@ -63,7 +63,7 @@ impl AstNode for ArrayExpr {
63 } 63 }
64 } 64 }
65 fn syntax(&self) -> &SyntaxNode { &self.syntax } 65 fn syntax(&self) -> &SyntaxNode { &self.syntax }
66 fn to_owned(&self) -> TreePtr<ArrayExpr> { TreePtr::cast(self.syntax.to_owned()) } 66 fn to_owned(&self) -> TreeArc<ArrayExpr> { TreeArc::cast(self.syntax.to_owned()) }
67} 67}
68 68
69 69
@@ -87,7 +87,7 @@ impl AstNode for ArrayType {
87 } 87 }
88 } 88 }
89 fn syntax(&self) -> &SyntaxNode { &self.syntax } 89 fn syntax(&self) -> &SyntaxNode { &self.syntax }
90 fn to_owned(&self) -> TreePtr<ArrayType> { TreePtr::cast(self.syntax.to_owned()) } 90 fn to_owned(&self) -> TreeArc<ArrayType> { TreeArc::cast(self.syntax.to_owned()) }
91} 91}
92 92
93 93
@@ -119,7 +119,7 @@ impl AstNode for Attr {
119 } 119 }
120 } 120 }
121 fn syntax(&self) -> &SyntaxNode { &self.syntax } 121 fn syntax(&self) -> &SyntaxNode { &self.syntax }
122 fn to_owned(&self) -> TreePtr<Attr> { TreePtr::cast(self.syntax.to_owned()) } 122 fn to_owned(&self) -> TreeArc<Attr> { TreeArc::cast(self.syntax.to_owned()) }
123} 123}
124 124
125 125
@@ -147,7 +147,7 @@ impl AstNode for BinExpr {
147 } 147 }
148 } 148 }
149 fn syntax(&self) -> &SyntaxNode { &self.syntax } 149 fn syntax(&self) -> &SyntaxNode { &self.syntax }
150 fn to_owned(&self) -> TreePtr<BinExpr> { TreePtr::cast(self.syntax.to_owned()) } 150 fn to_owned(&self) -> TreeArc<BinExpr> { TreeArc::cast(self.syntax.to_owned()) }
151} 151}
152 152
153 153
@@ -171,7 +171,7 @@ impl AstNode for BindPat {
171 } 171 }
172 } 172 }
173 fn syntax(&self) -> &SyntaxNode { &self.syntax } 173 fn syntax(&self) -> &SyntaxNode { &self.syntax }
174 fn to_owned(&self) -> TreePtr<BindPat> { TreePtr::cast(self.syntax.to_owned()) } 174 fn to_owned(&self) -> TreeArc<BindPat> { TreeArc::cast(self.syntax.to_owned()) }
175} 175}
176 176
177 177
@@ -196,7 +196,7 @@ impl AstNode for Block {
196 } 196 }
197 } 197 }
198 fn syntax(&self) -> &SyntaxNode { &self.syntax } 198 fn syntax(&self) -> &SyntaxNode { &self.syntax }
199 fn to_owned(&self) -> TreePtr<Block> { TreePtr::cast(self.syntax.to_owned()) } 199 fn to_owned(&self) -> TreeArc<Block> { TreeArc::cast(self.syntax.to_owned()) }
200} 200}
201 201
202 202
@@ -228,7 +228,7 @@ impl AstNode for BlockExpr {
228 } 228 }
229 } 229 }
230 fn syntax(&self) -> &SyntaxNode { &self.syntax } 230 fn syntax(&self) -> &SyntaxNode { &self.syntax }
231 fn to_owned(&self) -> TreePtr<BlockExpr> { TreePtr::cast(self.syntax.to_owned()) } 231 fn to_owned(&self) -> TreeArc<BlockExpr> { TreeArc::cast(self.syntax.to_owned()) }
232} 232}
233 233
234 234
@@ -256,7 +256,7 @@ impl AstNode for BreakExpr {
256 } 256 }
257 } 257 }
258 fn syntax(&self) -> &SyntaxNode { &self.syntax } 258 fn syntax(&self) -> &SyntaxNode { &self.syntax }
259 fn to_owned(&self) -> TreePtr<BreakExpr> { TreePtr::cast(self.syntax.to_owned()) } 259 fn to_owned(&self) -> TreeArc<BreakExpr> { TreeArc::cast(self.syntax.to_owned()) }
260} 260}
261 261
262 262
@@ -284,7 +284,7 @@ impl AstNode for Byte {
284 } 284 }
285 } 285 }
286 fn syntax(&self) -> &SyntaxNode { &self.syntax } 286 fn syntax(&self) -> &SyntaxNode { &self.syntax }
287 fn to_owned(&self) -> TreePtr<Byte> { TreePtr::cast(self.syntax.to_owned()) } 287 fn to_owned(&self) -> TreeArc<Byte> { TreeArc::cast(self.syntax.to_owned()) }
288} 288}
289 289
290 290
@@ -309,7 +309,7 @@ impl AstNode for ByteString {
309 } 309 }
310 } 310 }
311 fn syntax(&self) -> &SyntaxNode { &self.syntax } 311 fn syntax(&self) -> &SyntaxNode { &self.syntax }
312 fn to_owned(&self) -> TreePtr<ByteString> { TreePtr::cast(self.syntax.to_owned()) } 312 fn to_owned(&self) -> TreeArc<ByteString> { TreeArc::cast(self.syntax.to_owned()) }
313} 313}
314 314
315 315
@@ -334,7 +334,7 @@ impl AstNode for CallExpr {
334 } 334 }
335 } 335 }
336 fn syntax(&self) -> &SyntaxNode { &self.syntax } 336 fn syntax(&self) -> &SyntaxNode { &self.syntax }
337 fn to_owned(&self) -> TreePtr<CallExpr> { TreePtr::cast(self.syntax.to_owned()) } 337 fn to_owned(&self) -> TreeArc<CallExpr> { TreeArc::cast(self.syntax.to_owned()) }
338} 338}
339 339
340 340
@@ -363,7 +363,7 @@ impl AstNode for CastExpr {
363 } 363 }
364 } 364 }
365 fn syntax(&self) -> &SyntaxNode { &self.syntax } 365 fn syntax(&self) -> &SyntaxNode { &self.syntax }
366 fn to_owned(&self) -> TreePtr<CastExpr> { TreePtr::cast(self.syntax.to_owned()) } 366 fn to_owned(&self) -> TreeArc<CastExpr> { TreeArc::cast(self.syntax.to_owned()) }
367} 367}
368 368
369 369
@@ -395,7 +395,7 @@ impl AstNode for Char {
395 } 395 }
396 } 396 }
397 fn syntax(&self) -> &SyntaxNode { &self.syntax } 397 fn syntax(&self) -> &SyntaxNode { &self.syntax }
398 fn to_owned(&self) -> TreePtr<Char> { TreePtr::cast(self.syntax.to_owned()) } 398 fn to_owned(&self) -> TreeArc<Char> { TreeArc::cast(self.syntax.to_owned()) }
399} 399}
400 400
401 401
@@ -420,7 +420,7 @@ impl AstNode for Comment {
420 } 420 }
421 } 421 }
422 fn syntax(&self) -> &SyntaxNode { &self.syntax } 422 fn syntax(&self) -> &SyntaxNode { &self.syntax }
423 fn to_owned(&self) -> TreePtr<Comment> { TreePtr::cast(self.syntax.to_owned()) } 423 fn to_owned(&self) -> TreeArc<Comment> { TreeArc::cast(self.syntax.to_owned()) }
424} 424}
425 425
426 426
@@ -445,7 +445,7 @@ impl AstNode for Condition {
445 } 445 }
446 } 446 }
447 fn syntax(&self) -> &SyntaxNode { &self.syntax } 447 fn syntax(&self) -> &SyntaxNode { &self.syntax }
448 fn to_owned(&self) -> TreePtr<Condition> { TreePtr::cast(self.syntax.to_owned()) } 448 fn to_owned(&self) -> TreeArc<Condition> { TreeArc::cast(self.syntax.to_owned()) }
449} 449}
450 450
451 451
@@ -477,7 +477,7 @@ impl AstNode for ConstDef {
477 } 477 }
478 } 478 }
479 fn syntax(&self) -> &SyntaxNode { &self.syntax } 479 fn syntax(&self) -> &SyntaxNode { &self.syntax }
480 fn to_owned(&self) -> TreePtr<ConstDef> { TreePtr::cast(self.syntax.to_owned()) } 480 fn to_owned(&self) -> TreeArc<ConstDef> { TreeArc::cast(self.syntax.to_owned()) }
481} 481}
482 482
483 483
@@ -506,7 +506,7 @@ impl AstNode for ContinueExpr {
506 } 506 }
507 } 507 }
508 fn syntax(&self) -> &SyntaxNode { &self.syntax } 508 fn syntax(&self) -> &SyntaxNode { &self.syntax }
509 fn to_owned(&self) -> TreePtr<ContinueExpr> { TreePtr::cast(self.syntax.to_owned()) } 509 fn to_owned(&self) -> TreeArc<ContinueExpr> { TreeArc::cast(self.syntax.to_owned()) }
510} 510}
511 511
512 512
@@ -530,7 +530,7 @@ impl AstNode for DynTraitType {
530 } 530 }
531 } 531 }
532 fn syntax(&self) -> &SyntaxNode { &self.syntax } 532 fn syntax(&self) -> &SyntaxNode { &self.syntax }
533 fn to_owned(&self) -> TreePtr<DynTraitType> { TreePtr::cast(self.syntax.to_owned()) } 533 fn to_owned(&self) -> TreeArc<DynTraitType> { TreeArc::cast(self.syntax.to_owned()) }
534} 534}
535 535
536 536
@@ -554,7 +554,7 @@ impl AstNode for EnumDef {
554 } 554 }
555 } 555 }
556 fn syntax(&self) -> &SyntaxNode { &self.syntax } 556 fn syntax(&self) -> &SyntaxNode { &self.syntax }
557 fn to_owned(&self) -> TreePtr<EnumDef> { TreePtr::cast(self.syntax.to_owned()) } 557 fn to_owned(&self) -> TreeArc<EnumDef> { TreeArc::cast(self.syntax.to_owned()) }
558} 558}
559 559
560 560
@@ -587,7 +587,7 @@ impl AstNode for EnumVariant {
587 } 587 }
588 } 588 }
589 fn syntax(&self) -> &SyntaxNode { &self.syntax } 589 fn syntax(&self) -> &SyntaxNode { &self.syntax }
590 fn to_owned(&self) -> TreePtr<EnumVariant> { TreePtr::cast(self.syntax.to_owned()) } 590 fn to_owned(&self) -> TreeArc<EnumVariant> { TreeArc::cast(self.syntax.to_owned()) }
591} 591}
592 592
593 593
@@ -616,7 +616,7 @@ impl AstNode for EnumVariantList {
616 } 616 }
617 } 617 }
618 fn syntax(&self) -> &SyntaxNode { &self.syntax } 618 fn syntax(&self) -> &SyntaxNode { &self.syntax }
619 fn to_owned(&self) -> TreePtr<EnumVariantList> { TreePtr::cast(self.syntax.to_owned()) } 619 fn to_owned(&self) -> TreeArc<EnumVariantList> { TreeArc::cast(self.syntax.to_owned()) }
620} 620}
621 621
622 622
@@ -701,7 +701,7 @@ impl AstNode for Expr {
701 } 701 }
702 } 702 }
703 fn syntax(&self) -> &SyntaxNode { &self.syntax } 703 fn syntax(&self) -> &SyntaxNode { &self.syntax }
704 fn to_owned(&self) -> TreePtr<Expr> { TreePtr::cast(self.syntax.to_owned()) } 704 fn to_owned(&self) -> TreeArc<Expr> { TreeArc::cast(self.syntax.to_owned()) }
705} 705}
706 706
707impl Expr { 707impl Expr {
@@ -759,7 +759,7 @@ impl AstNode for ExprStmt {
759 } 759 }
760 } 760 }
761 fn syntax(&self) -> &SyntaxNode { &self.syntax } 761 fn syntax(&self) -> &SyntaxNode { &self.syntax }
762 fn to_owned(&self) -> TreePtr<ExprStmt> { TreePtr::cast(self.syntax.to_owned()) } 762 fn to_owned(&self) -> TreeArc<ExprStmt> { TreeArc::cast(self.syntax.to_owned()) }
763} 763}
764 764
765 765
@@ -787,7 +787,7 @@ impl AstNode for ExternCrateItem {
787 } 787 }
788 } 788 }
789 fn syntax(&self) -> &SyntaxNode { &self.syntax } 789 fn syntax(&self) -> &SyntaxNode { &self.syntax }
790 fn to_owned(&self) -> TreePtr<ExternCrateItem> { TreePtr::cast(self.syntax.to_owned()) } 790 fn to_owned(&self) -> TreeArc<ExternCrateItem> { TreeArc::cast(self.syntax.to_owned()) }
791} 791}
792 792
793 793
@@ -811,7 +811,7 @@ impl AstNode for FieldExpr {
811 } 811 }
812 } 812 }
813 fn syntax(&self) -> &SyntaxNode { &self.syntax } 813 fn syntax(&self) -> &SyntaxNode { &self.syntax }
814 fn to_owned(&self) -> TreePtr<FieldExpr> { TreePtr::cast(self.syntax.to_owned()) } 814 fn to_owned(&self) -> TreeArc<FieldExpr> { TreeArc::cast(self.syntax.to_owned()) }
815} 815}
816 816
817 817
@@ -843,7 +843,7 @@ impl AstNode for FieldPatList {
843 } 843 }
844 } 844 }
845 fn syntax(&self) -> &SyntaxNode { &self.syntax } 845 fn syntax(&self) -> &SyntaxNode { &self.syntax }
846 fn to_owned(&self) -> TreePtr<FieldPatList> { TreePtr::cast(self.syntax.to_owned()) } 846 fn to_owned(&self) -> TreeArc<FieldPatList> { TreeArc::cast(self.syntax.to_owned()) }
847} 847}
848 848
849 849
@@ -867,7 +867,7 @@ impl AstNode for FnDef {
867 } 867 }
868 } 868 }
869 fn syntax(&self) -> &SyntaxNode { &self.syntax } 869 fn syntax(&self) -> &SyntaxNode { &self.syntax }
870 fn to_owned(&self) -> TreePtr<FnDef> { TreePtr::cast(self.syntax.to_owned()) } 870 fn to_owned(&self) -> TreeArc<FnDef> { TreeArc::cast(self.syntax.to_owned()) }
871} 871}
872 872
873 873
@@ -908,7 +908,7 @@ impl AstNode for FnPointerType {
908 } 908 }
909 } 909 }
910 fn syntax(&self) -> &SyntaxNode { &self.syntax } 910 fn syntax(&self) -> &SyntaxNode { &self.syntax }
911 fn to_owned(&self) -> TreePtr<FnPointerType> { TreePtr::cast(self.syntax.to_owned()) } 911 fn to_owned(&self) -> TreeArc<FnPointerType> { TreeArc::cast(self.syntax.to_owned()) }
912} 912}
913 913
914 914
@@ -940,7 +940,7 @@ impl AstNode for ForExpr {
940 } 940 }
941 } 941 }
942 fn syntax(&self) -> &SyntaxNode { &self.syntax } 942 fn syntax(&self) -> &SyntaxNode { &self.syntax }
943 fn to_owned(&self) -> TreePtr<ForExpr> { TreePtr::cast(self.syntax.to_owned()) } 943 fn to_owned(&self) -> TreeArc<ForExpr> { TreeArc::cast(self.syntax.to_owned()) }
944} 944}
945 945
946 946
@@ -973,7 +973,7 @@ impl AstNode for ForType {
973 } 973 }
974 } 974 }
975 fn syntax(&self) -> &SyntaxNode { &self.syntax } 975 fn syntax(&self) -> &SyntaxNode { &self.syntax }
976 fn to_owned(&self) -> TreePtr<ForType> { TreePtr::cast(self.syntax.to_owned()) } 976 fn to_owned(&self) -> TreeArc<ForType> { TreeArc::cast(self.syntax.to_owned()) }
977} 977}
978 978
979 979
@@ -1001,7 +1001,7 @@ impl AstNode for IfExpr {
1001 } 1001 }
1002 } 1002 }
1003 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1003 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1004 fn to_owned(&self) -> TreePtr<IfExpr> { TreePtr::cast(self.syntax.to_owned()) } 1004 fn to_owned(&self) -> TreeArc<IfExpr> { TreeArc::cast(self.syntax.to_owned()) }
1005} 1005}
1006 1006
1007 1007
@@ -1029,7 +1029,7 @@ impl AstNode for ImplBlock {
1029 } 1029 }
1030 } 1030 }
1031 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1031 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1032 fn to_owned(&self) -> TreePtr<ImplBlock> { TreePtr::cast(self.syntax.to_owned()) } 1032 fn to_owned(&self) -> TreeArc<ImplBlock> { TreeArc::cast(self.syntax.to_owned()) }
1033} 1033}
1034 1034
1035 1035
@@ -1066,7 +1066,7 @@ impl AstNode for ImplItem {
1066 } 1066 }
1067 } 1067 }
1068 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1068 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1069 fn to_owned(&self) -> TreePtr<ImplItem> { TreePtr::cast(self.syntax.to_owned()) } 1069 fn to_owned(&self) -> TreeArc<ImplItem> { TreeArc::cast(self.syntax.to_owned()) }
1070} 1070}
1071 1071
1072impl ImplItem { 1072impl ImplItem {
@@ -1100,7 +1100,7 @@ impl AstNode for ImplTraitType {
1100 } 1100 }
1101 } 1101 }
1102 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1102 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1103 fn to_owned(&self) -> TreePtr<ImplTraitType> { TreePtr::cast(self.syntax.to_owned()) } 1103 fn to_owned(&self) -> TreeArc<ImplTraitType> { TreeArc::cast(self.syntax.to_owned()) }
1104} 1104}
1105 1105
1106 1106
@@ -1124,7 +1124,7 @@ impl AstNode for IndexExpr {
1124 } 1124 }
1125 } 1125 }
1126 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1126 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1127 fn to_owned(&self) -> TreePtr<IndexExpr> { TreePtr::cast(self.syntax.to_owned()) } 1127 fn to_owned(&self) -> TreeArc<IndexExpr> { TreeArc::cast(self.syntax.to_owned()) }
1128} 1128}
1129 1129
1130 1130
@@ -1148,7 +1148,7 @@ impl AstNode for ItemList {
1148 } 1148 }
1149 } 1149 }
1150 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1150 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1151 fn to_owned(&self) -> TreePtr<ItemList> { TreePtr::cast(self.syntax.to_owned()) } 1151 fn to_owned(&self) -> TreeArc<ItemList> { TreeArc::cast(self.syntax.to_owned()) }
1152} 1152}
1153 1153
1154 1154
@@ -1178,7 +1178,7 @@ impl AstNode for Label {
1178 } 1178 }
1179 } 1179 }
1180 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1180 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1181 fn to_owned(&self) -> TreePtr<Label> { TreePtr::cast(self.syntax.to_owned()) } 1181 fn to_owned(&self) -> TreeArc<Label> { TreeArc::cast(self.syntax.to_owned()) }
1182} 1182}
1183 1183
1184 1184
@@ -1202,7 +1202,7 @@ impl AstNode for LambdaExpr {
1202 } 1202 }
1203 } 1203 }
1204 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1204 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1205 fn to_owned(&self) -> TreePtr<LambdaExpr> { TreePtr::cast(self.syntax.to_owned()) } 1205 fn to_owned(&self) -> TreeArc<LambdaExpr> { TreeArc::cast(self.syntax.to_owned()) }
1206} 1206}
1207 1207
1208 1208
@@ -1234,7 +1234,7 @@ impl AstNode for LetStmt {
1234 } 1234 }
1235 } 1235 }
1236 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1236 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1237 fn to_owned(&self) -> TreePtr<LetStmt> { TreePtr::cast(self.syntax.to_owned()) } 1237 fn to_owned(&self) -> TreeArc<LetStmt> { TreeArc::cast(self.syntax.to_owned()) }
1238} 1238}
1239 1239
1240 1240
@@ -1270,7 +1270,7 @@ impl AstNode for Lifetime {
1270 } 1270 }
1271 } 1271 }
1272 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1272 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1273 fn to_owned(&self) -> TreePtr<Lifetime> { TreePtr::cast(self.syntax.to_owned()) } 1273 fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) }
1274} 1274}
1275 1275
1276 1276
@@ -1295,7 +1295,7 @@ impl AstNode for LifetimeParam {
1295 } 1295 }
1296 } 1296 }
1297 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1297 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1298 fn to_owned(&self) -> TreePtr<LifetimeParam> { TreePtr::cast(self.syntax.to_owned()) } 1298 fn to_owned(&self) -> TreeArc<LifetimeParam> { TreeArc::cast(self.syntax.to_owned()) }
1299} 1299}
1300 1300
1301 1301
@@ -1323,7 +1323,7 @@ impl AstNode for Literal {
1323 } 1323 }
1324 } 1324 }
1325 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1325 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1326 fn to_owned(&self) -> TreePtr<Literal> { TreePtr::cast(self.syntax.to_owned()) } 1326 fn to_owned(&self) -> TreeArc<Literal> { TreeArc::cast(self.syntax.to_owned()) }
1327} 1327}
1328 1328
1329 1329
@@ -1347,7 +1347,7 @@ impl AstNode for LoopExpr {
1347 } 1347 }
1348 } 1348 }
1349 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1349 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1350 fn to_owned(&self) -> TreePtr<LoopExpr> { TreePtr::cast(self.syntax.to_owned()) } 1350 fn to_owned(&self) -> TreeArc<LoopExpr> { TreeArc::cast(self.syntax.to_owned()) }
1351} 1351}
1352 1352
1353 1353
@@ -1372,7 +1372,7 @@ impl AstNode for MacroCall {
1372 } 1372 }
1373 } 1373 }
1374 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1374 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1375 fn to_owned(&self) -> TreePtr<MacroCall> { TreePtr::cast(self.syntax.to_owned()) } 1375 fn to_owned(&self) -> TreeArc<MacroCall> { TreeArc::cast(self.syntax.to_owned()) }
1376} 1376}
1377 1377
1378 1378
@@ -1404,7 +1404,7 @@ impl AstNode for MatchArm {
1404 } 1404 }
1405 } 1405 }
1406 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1406 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1407 fn to_owned(&self) -> TreePtr<MatchArm> { TreePtr::cast(self.syntax.to_owned()) } 1407 fn to_owned(&self) -> TreeArc<MatchArm> { TreeArc::cast(self.syntax.to_owned()) }
1408} 1408}
1409 1409
1410 1410
@@ -1440,7 +1440,7 @@ impl AstNode for MatchArmList {
1440 } 1440 }
1441 } 1441 }
1442 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1442 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1443 fn to_owned(&self) -> TreePtr<MatchArmList> { TreePtr::cast(self.syntax.to_owned()) } 1443 fn to_owned(&self) -> TreeArc<MatchArmList> { TreeArc::cast(self.syntax.to_owned()) }
1444} 1444}
1445 1445
1446 1446
@@ -1468,7 +1468,7 @@ impl AstNode for MatchExpr {
1468 } 1468 }
1469 } 1469 }
1470 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1470 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1471 fn to_owned(&self) -> TreePtr<MatchExpr> { TreePtr::cast(self.syntax.to_owned()) } 1471 fn to_owned(&self) -> TreeArc<MatchExpr> { TreeArc::cast(self.syntax.to_owned()) }
1472} 1472}
1473 1473
1474 1474
@@ -1500,7 +1500,7 @@ impl AstNode for MatchGuard {
1500 } 1500 }
1501 } 1501 }
1502 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1502 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1503 fn to_owned(&self) -> TreePtr<MatchGuard> { TreePtr::cast(self.syntax.to_owned()) } 1503 fn to_owned(&self) -> TreeArc<MatchGuard> { TreeArc::cast(self.syntax.to_owned()) }
1504} 1504}
1505 1505
1506 1506
@@ -1524,7 +1524,7 @@ impl AstNode for MethodCallExpr {
1524 } 1524 }
1525 } 1525 }
1526 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1526 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1527 fn to_owned(&self) -> TreePtr<MethodCallExpr> { TreePtr::cast(self.syntax.to_owned()) } 1527 fn to_owned(&self) -> TreeArc<MethodCallExpr> { TreeArc::cast(self.syntax.to_owned()) }
1528} 1528}
1529 1529
1530 1530
@@ -1557,7 +1557,7 @@ impl AstNode for Module {
1557 } 1557 }
1558 } 1558 }
1559 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1559 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1560 fn to_owned(&self) -> TreePtr<Module> { TreePtr::cast(self.syntax.to_owned()) } 1560 fn to_owned(&self) -> TreeArc<Module> { TreeArc::cast(self.syntax.to_owned()) }
1561} 1561}
1562 1562
1563 1563
@@ -1614,7 +1614,7 @@ impl AstNode for ModuleItem {
1614 } 1614 }
1615 } 1615 }
1616 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1616 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1617 fn to_owned(&self) -> TreePtr<ModuleItem> { TreePtr::cast(self.syntax.to_owned()) } 1617 fn to_owned(&self) -> TreeArc<ModuleItem> { TreeArc::cast(self.syntax.to_owned()) }
1618} 1618}
1619 1619
1620impl ModuleItem { 1620impl ModuleItem {
@@ -1656,7 +1656,7 @@ impl AstNode for Name {
1656 } 1656 }
1657 } 1657 }
1658 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1658 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1659 fn to_owned(&self) -> TreePtr<Name> { TreePtr::cast(self.syntax.to_owned()) } 1659 fn to_owned(&self) -> TreeArc<Name> { TreeArc::cast(self.syntax.to_owned()) }
1660} 1660}
1661 1661
1662 1662
@@ -1680,7 +1680,7 @@ impl AstNode for NameRef {
1680 } 1680 }
1681 } 1681 }
1682 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1682 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1683 fn to_owned(&self) -> TreePtr<NameRef> { TreePtr::cast(self.syntax.to_owned()) } 1683 fn to_owned(&self) -> TreeArc<NameRef> { TreeArc::cast(self.syntax.to_owned()) }
1684} 1684}
1685 1685
1686 1686
@@ -1704,7 +1704,7 @@ impl AstNode for NamedField {
1704 } 1704 }
1705 } 1705 }
1706 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1706 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1707 fn to_owned(&self) -> TreePtr<NamedField> { TreePtr::cast(self.syntax.to_owned()) } 1707 fn to_owned(&self) -> TreeArc<NamedField> { TreeArc::cast(self.syntax.to_owned()) }
1708} 1708}
1709 1709
1710 1710
@@ -1736,7 +1736,7 @@ impl AstNode for NamedFieldDef {
1736 } 1736 }
1737 } 1737 }
1738 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1738 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1739 fn to_owned(&self) -> TreePtr<NamedFieldDef> { TreePtr::cast(self.syntax.to_owned()) } 1739 fn to_owned(&self) -> TreeArc<NamedFieldDef> { TreeArc::cast(self.syntax.to_owned()) }
1740} 1740}
1741 1741
1742 1742
@@ -1767,7 +1767,7 @@ impl AstNode for NamedFieldDefList {
1767 } 1767 }
1768 } 1768 }
1769 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1769 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1770 fn to_owned(&self) -> TreePtr<NamedFieldDefList> { TreePtr::cast(self.syntax.to_owned()) } 1770 fn to_owned(&self) -> TreeArc<NamedFieldDefList> { TreeArc::cast(self.syntax.to_owned()) }
1771} 1771}
1772 1772
1773 1773
@@ -1795,7 +1795,7 @@ impl AstNode for NamedFieldList {
1795 } 1795 }
1796 } 1796 }
1797 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1797 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1798 fn to_owned(&self) -> TreePtr<NamedFieldList> { TreePtr::cast(self.syntax.to_owned()) } 1798 fn to_owned(&self) -> TreeArc<NamedFieldList> { TreeArc::cast(self.syntax.to_owned()) }
1799} 1799}
1800 1800
1801 1801
@@ -1823,7 +1823,7 @@ impl AstNode for NeverType {
1823 } 1823 }
1824 } 1824 }
1825 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1825 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1826 fn to_owned(&self) -> TreePtr<NeverType> { TreePtr::cast(self.syntax.to_owned()) } 1826 fn to_owned(&self) -> TreeArc<NeverType> { TreeArc::cast(self.syntax.to_owned()) }
1827} 1827}
1828 1828
1829 1829
@@ -1854,7 +1854,7 @@ impl AstNode for NominalDef {
1854 } 1854 }
1855 } 1855 }
1856 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1856 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1857 fn to_owned(&self) -> TreePtr<NominalDef> { TreePtr::cast(self.syntax.to_owned()) } 1857 fn to_owned(&self) -> TreeArc<NominalDef> { TreeArc::cast(self.syntax.to_owned()) }
1858} 1858}
1859 1859
1860impl NominalDef { 1860impl NominalDef {
@@ -1890,7 +1890,7 @@ impl AstNode for Param {
1890 } 1890 }
1891 } 1891 }
1892 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1892 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1893 fn to_owned(&self) -> TreePtr<Param> { TreePtr::cast(self.syntax.to_owned()) } 1893 fn to_owned(&self) -> TreeArc<Param> { TreeArc::cast(self.syntax.to_owned()) }
1894} 1894}
1895 1895
1896 1896
@@ -1922,7 +1922,7 @@ impl AstNode for ParamList {
1922 } 1922 }
1923 } 1923 }
1924 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1924 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1925 fn to_owned(&self) -> TreePtr<ParamList> { TreePtr::cast(self.syntax.to_owned()) } 1925 fn to_owned(&self) -> TreeArc<ParamList> { TreeArc::cast(self.syntax.to_owned()) }
1926} 1926}
1927 1927
1928 1928
@@ -1954,7 +1954,7 @@ impl AstNode for ParenExpr {
1954 } 1954 }
1955 } 1955 }
1956 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1956 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1957 fn to_owned(&self) -> TreePtr<ParenExpr> { TreePtr::cast(self.syntax.to_owned()) } 1957 fn to_owned(&self) -> TreeArc<ParenExpr> { TreeArc::cast(self.syntax.to_owned()) }
1958} 1958}
1959 1959
1960 1960
@@ -1982,7 +1982,7 @@ impl AstNode for ParenType {
1982 } 1982 }
1983 } 1983 }
1984 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1984 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1985 fn to_owned(&self) -> TreePtr<ParenType> { TreePtr::cast(self.syntax.to_owned()) } 1985 fn to_owned(&self) -> TreeArc<ParenType> { TreeArc::cast(self.syntax.to_owned()) }
1986} 1986}
1987 1987
1988 1988
@@ -2033,7 +2033,7 @@ impl AstNode for Pat {
2033 } 2033 }
2034 } 2034 }
2035 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2035 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2036 fn to_owned(&self) -> TreePtr<Pat> { TreePtr::cast(self.syntax.to_owned()) } 2036 fn to_owned(&self) -> TreeArc<Pat> { TreeArc::cast(self.syntax.to_owned()) }
2037} 2037}
2038 2038
2039impl Pat { 2039impl Pat {
@@ -2074,7 +2074,7 @@ impl AstNode for Path {
2074 } 2074 }
2075 } 2075 }
2076 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2076 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2077 fn to_owned(&self) -> TreePtr<Path> { TreePtr::cast(self.syntax.to_owned()) } 2077 fn to_owned(&self) -> TreeArc<Path> { TreeArc::cast(self.syntax.to_owned()) }
2078} 2078}
2079 2079
2080 2080
@@ -2106,7 +2106,7 @@ impl AstNode for PathExpr {
2106 } 2106 }
2107 } 2107 }
2108 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2108 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2109 fn to_owned(&self) -> TreePtr<PathExpr> { TreePtr::cast(self.syntax.to_owned()) } 2109 fn to_owned(&self) -> TreeArc<PathExpr> { TreeArc::cast(self.syntax.to_owned()) }
2110} 2110}
2111 2111
2112 2112
@@ -2134,7 +2134,7 @@ impl AstNode for PathPat {
2134 } 2134 }
2135 } 2135 }
2136 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2136 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2137 fn to_owned(&self) -> TreePtr<PathPat> { TreePtr::cast(self.syntax.to_owned()) } 2137 fn to_owned(&self) -> TreeArc<PathPat> { TreeArc::cast(self.syntax.to_owned()) }
2138} 2138}
2139 2139
2140 2140
@@ -2158,7 +2158,7 @@ impl AstNode for PathSegment {
2158 } 2158 }
2159 } 2159 }
2160 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2160 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2161 fn to_owned(&self) -> TreePtr<PathSegment> { TreePtr::cast(self.syntax.to_owned()) } 2161 fn to_owned(&self) -> TreeArc<PathSegment> { TreeArc::cast(self.syntax.to_owned()) }
2162} 2162}
2163 2163
2164 2164
@@ -2186,7 +2186,7 @@ impl AstNode for PathType {
2186 } 2186 }
2187 } 2187 }
2188 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2188 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2189 fn to_owned(&self) -> TreePtr<PathType> { TreePtr::cast(self.syntax.to_owned()) } 2189 fn to_owned(&self) -> TreeArc<PathType> { TreeArc::cast(self.syntax.to_owned()) }
2190} 2190}
2191 2191
2192 2192
@@ -2214,7 +2214,7 @@ impl AstNode for PlaceholderPat {
2214 } 2214 }
2215 } 2215 }
2216 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2216 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2217 fn to_owned(&self) -> TreePtr<PlaceholderPat> { TreePtr::cast(self.syntax.to_owned()) } 2217 fn to_owned(&self) -> TreeArc<PlaceholderPat> { TreeArc::cast(self.syntax.to_owned()) }
2218} 2218}
2219 2219
2220 2220
@@ -2238,7 +2238,7 @@ impl AstNode for PlaceholderType {
2238 } 2238 }
2239 } 2239 }
2240 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2240 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2241 fn to_owned(&self) -> TreePtr<PlaceholderType> { TreePtr::cast(self.syntax.to_owned()) } 2241 fn to_owned(&self) -> TreeArc<PlaceholderType> { TreeArc::cast(self.syntax.to_owned()) }
2242} 2242}
2243 2243
2244 2244
@@ -2262,7 +2262,7 @@ impl AstNode for PointerType {
2262 } 2262 }
2263 } 2263 }
2264 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2264 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2265 fn to_owned(&self) -> TreePtr<PointerType> { TreePtr::cast(self.syntax.to_owned()) } 2265 fn to_owned(&self) -> TreeArc<PointerType> { TreeArc::cast(self.syntax.to_owned()) }
2266} 2266}
2267 2267
2268 2268
@@ -2290,7 +2290,7 @@ impl AstNode for PosField {
2290 } 2290 }
2291 } 2291 }
2292 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2292 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2293 fn to_owned(&self) -> TreePtr<PosField> { TreePtr::cast(self.syntax.to_owned()) } 2293 fn to_owned(&self) -> TreeArc<PosField> { TreeArc::cast(self.syntax.to_owned()) }
2294} 2294}
2295 2295
2296 2296
@@ -2320,7 +2320,7 @@ impl AstNode for PosFieldList {
2320 } 2320 }
2321 } 2321 }
2322 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2322 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2323 fn to_owned(&self) -> TreePtr<PosFieldList> { TreePtr::cast(self.syntax.to_owned()) } 2323 fn to_owned(&self) -> TreeArc<PosFieldList> { TreeArc::cast(self.syntax.to_owned()) }
2324} 2324}
2325 2325
2326 2326
@@ -2348,7 +2348,7 @@ impl AstNode for PrefixExpr {
2348 } 2348 }
2349 } 2349 }
2350 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2350 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2351 fn to_owned(&self) -> TreePtr<PrefixExpr> { TreePtr::cast(self.syntax.to_owned()) } 2351 fn to_owned(&self) -> TreeArc<PrefixExpr> { TreeArc::cast(self.syntax.to_owned()) }
2352} 2352}
2353 2353
2354 2354
@@ -2376,7 +2376,7 @@ impl AstNode for RangeExpr {
2376 } 2376 }
2377 } 2377 }
2378 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2378 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2379 fn to_owned(&self) -> TreePtr<RangeExpr> { TreePtr::cast(self.syntax.to_owned()) } 2379 fn to_owned(&self) -> TreeArc<RangeExpr> { TreeArc::cast(self.syntax.to_owned()) }
2380} 2380}
2381 2381
2382 2382
@@ -2400,7 +2400,7 @@ impl AstNode for RangePat {
2400 } 2400 }
2401 } 2401 }
2402 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2402 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2403 fn to_owned(&self) -> TreePtr<RangePat> { TreePtr::cast(self.syntax.to_owned()) } 2403 fn to_owned(&self) -> TreeArc<RangePat> { TreeArc::cast(self.syntax.to_owned()) }
2404} 2404}
2405 2405
2406 2406
@@ -2424,7 +2424,7 @@ impl AstNode for RefExpr {
2424 } 2424 }
2425 } 2425 }
2426 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2426 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2427 fn to_owned(&self) -> TreePtr<RefExpr> { TreePtr::cast(self.syntax.to_owned()) } 2427 fn to_owned(&self) -> TreeArc<RefExpr> { TreeArc::cast(self.syntax.to_owned()) }
2428} 2428}
2429 2429
2430 2430
@@ -2452,7 +2452,7 @@ impl AstNode for RefPat {
2452 } 2452 }
2453 } 2453 }
2454 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2454 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2455 fn to_owned(&self) -> TreePtr<RefPat> { TreePtr::cast(self.syntax.to_owned()) } 2455 fn to_owned(&self) -> TreeArc<RefPat> { TreeArc::cast(self.syntax.to_owned()) }
2456} 2456}
2457 2457
2458 2458
@@ -2476,7 +2476,7 @@ impl AstNode for ReferenceType {
2476 } 2476 }
2477 } 2477 }
2478 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2478 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2479 fn to_owned(&self) -> TreePtr<ReferenceType> { TreePtr::cast(self.syntax.to_owned()) } 2479 fn to_owned(&self) -> TreeArc<ReferenceType> { TreeArc::cast(self.syntax.to_owned()) }
2480} 2480}
2481 2481
2482 2482
@@ -2504,7 +2504,7 @@ impl AstNode for RetType {
2504 } 2504 }
2505 } 2505 }
2506 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2506 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2507 fn to_owned(&self) -> TreePtr<RetType> { TreePtr::cast(self.syntax.to_owned()) } 2507 fn to_owned(&self) -> TreeArc<RetType> { TreeArc::cast(self.syntax.to_owned()) }
2508} 2508}
2509 2509
2510 2510
@@ -2532,7 +2532,7 @@ impl AstNode for ReturnExpr {
2532 } 2532 }
2533 } 2533 }
2534 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2534 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2535 fn to_owned(&self) -> TreePtr<ReturnExpr> { TreePtr::cast(self.syntax.to_owned()) } 2535 fn to_owned(&self) -> TreeArc<ReturnExpr> { TreeArc::cast(self.syntax.to_owned()) }
2536} 2536}
2537 2537
2538 2538
@@ -2560,7 +2560,7 @@ impl AstNode for SelfKw {
2560 } 2560 }
2561 } 2561 }
2562 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2562 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2563 fn to_owned(&self) -> TreePtr<SelfKw> { TreePtr::cast(self.syntax.to_owned()) } 2563 fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) }
2564} 2564}
2565 2565
2566 2566
@@ -2584,7 +2584,7 @@ impl AstNode for SelfParam {
2584 } 2584 }
2585 } 2585 }
2586 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2586 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2587 fn to_owned(&self) -> TreePtr<SelfParam> { TreePtr::cast(self.syntax.to_owned()) } 2587 fn to_owned(&self) -> TreeArc<SelfParam> { TreeArc::cast(self.syntax.to_owned()) }
2588} 2588}
2589 2589
2590 2590
@@ -2616,7 +2616,7 @@ impl AstNode for SlicePat {
2616 } 2616 }
2617 } 2617 }
2618 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2618 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2619 fn to_owned(&self) -> TreePtr<SlicePat> { TreePtr::cast(self.syntax.to_owned()) } 2619 fn to_owned(&self) -> TreeArc<SlicePat> { TreeArc::cast(self.syntax.to_owned()) }
2620} 2620}
2621 2621
2622 2622
@@ -2640,7 +2640,7 @@ impl AstNode for SliceType {
2640 } 2640 }
2641 } 2641 }
2642 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2642 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2643 fn to_owned(&self) -> TreePtr<SliceType> { TreePtr::cast(self.syntax.to_owned()) } 2643 fn to_owned(&self) -> TreeArc<SliceType> { TreeArc::cast(self.syntax.to_owned()) }
2644} 2644}
2645 2645
2646 2646
@@ -2668,7 +2668,7 @@ impl AstNode for SourceFile {
2668 } 2668 }
2669 } 2669 }
2670 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2670 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2671 fn to_owned(&self) -> TreePtr<SourceFile> { TreePtr::cast(self.syntax.to_owned()) } 2671 fn to_owned(&self) -> TreeArc<SourceFile> { TreeArc::cast(self.syntax.to_owned()) }
2672} 2672}
2673 2673
2674 2674
@@ -2698,7 +2698,7 @@ impl AstNode for StaticDef {
2698 } 2698 }
2699 } 2699 }
2700 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2700 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2701 fn to_owned(&self) -> TreePtr<StaticDef> { TreePtr::cast(self.syntax.to_owned()) } 2701 fn to_owned(&self) -> TreeArc<StaticDef> { TreeArc::cast(self.syntax.to_owned()) }
2702} 2702}
2703 2703
2704 2704
@@ -2734,7 +2734,7 @@ impl AstNode for Stmt {
2734 } 2734 }
2735 } 2735 }
2736 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2736 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2737 fn to_owned(&self) -> TreePtr<Stmt> { TreePtr::cast(self.syntax.to_owned()) } 2737 fn to_owned(&self) -> TreeArc<Stmt> { TreeArc::cast(self.syntax.to_owned()) }
2738} 2738}
2739 2739
2740impl Stmt { 2740impl Stmt {
@@ -2767,7 +2767,7 @@ impl AstNode for String {
2767 } 2767 }
2768 } 2768 }
2769 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2769 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2770 fn to_owned(&self) -> TreePtr<String> { TreePtr::cast(self.syntax.to_owned()) } 2770 fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) }
2771} 2771}
2772 2772
2773 2773
@@ -2792,7 +2792,7 @@ impl AstNode for StructDef {
2792 } 2792 }
2793 } 2793 }
2794 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2794 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2795 fn to_owned(&self) -> TreePtr<StructDef> { TreePtr::cast(self.syntax.to_owned()) } 2795 fn to_owned(&self) -> TreeArc<StructDef> { TreeArc::cast(self.syntax.to_owned()) }
2796} 2796}
2797 2797
2798 2798
@@ -2821,7 +2821,7 @@ impl AstNode for StructLit {
2821 } 2821 }
2822 } 2822 }
2823 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2823 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2824 fn to_owned(&self) -> TreePtr<StructLit> { TreePtr::cast(self.syntax.to_owned()) } 2824 fn to_owned(&self) -> TreeArc<StructLit> { TreeArc::cast(self.syntax.to_owned()) }
2825} 2825}
2826 2826
2827 2827
@@ -2857,7 +2857,7 @@ impl AstNode for StructPat {
2857 } 2857 }
2858 } 2858 }
2859 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2859 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2860 fn to_owned(&self) -> TreePtr<StructPat> { TreePtr::cast(self.syntax.to_owned()) } 2860 fn to_owned(&self) -> TreeArc<StructPat> { TreeArc::cast(self.syntax.to_owned()) }
2861} 2861}
2862 2862
2863 2863
@@ -2881,7 +2881,7 @@ impl AstNode for TokenTree {
2881 } 2881 }
2882 } 2882 }
2883 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2883 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2884 fn to_owned(&self) -> TreePtr<TokenTree> { TreePtr::cast(self.syntax.to_owned()) } 2884 fn to_owned(&self) -> TreeArc<TokenTree> { TreeArc::cast(self.syntax.to_owned()) }
2885} 2885}
2886 2886
2887 2887
@@ -2905,7 +2905,7 @@ impl AstNode for TraitDef {
2905 } 2905 }
2906 } 2906 }
2907 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2907 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2908 fn to_owned(&self) -> TreePtr<TraitDef> { TreePtr::cast(self.syntax.to_owned()) } 2908 fn to_owned(&self) -> TreeArc<TraitDef> { TreeArc::cast(self.syntax.to_owned()) }
2909} 2909}
2910 2910
2911 2911
@@ -2933,7 +2933,7 @@ impl AstNode for TryExpr {
2933 } 2933 }
2934 } 2934 }
2935 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2935 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2936 fn to_owned(&self) -> TreePtr<TryExpr> { TreePtr::cast(self.syntax.to_owned()) } 2936 fn to_owned(&self) -> TreeArc<TryExpr> { TreeArc::cast(self.syntax.to_owned()) }
2937} 2937}
2938 2938
2939 2939
@@ -2961,7 +2961,7 @@ impl AstNode for TupleExpr {
2961 } 2961 }
2962 } 2962 }
2963 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2963 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2964 fn to_owned(&self) -> TreePtr<TupleExpr> { TreePtr::cast(self.syntax.to_owned()) } 2964 fn to_owned(&self) -> TreeArc<TupleExpr> { TreeArc::cast(self.syntax.to_owned()) }
2965} 2965}
2966 2966
2967 2967
@@ -2985,7 +2985,7 @@ impl AstNode for TuplePat {
2985 } 2985 }
2986 } 2986 }
2987 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2987 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2988 fn to_owned(&self) -> TreePtr<TuplePat> { TreePtr::cast(self.syntax.to_owned()) } 2988 fn to_owned(&self) -> TreeArc<TuplePat> { TreeArc::cast(self.syntax.to_owned()) }
2989} 2989}
2990 2990
2991 2991
@@ -3009,7 +3009,7 @@ impl AstNode for TupleStructPat {
3009 } 3009 }
3010 } 3010 }
3011 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3011 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3012 fn to_owned(&self) -> TreePtr<TupleStructPat> { TreePtr::cast(self.syntax.to_owned()) } 3012 fn to_owned(&self) -> TreeArc<TupleStructPat> { TreeArc::cast(self.syntax.to_owned()) }
3013} 3013}
3014 3014
3015 3015
@@ -3041,7 +3041,7 @@ impl AstNode for TupleType {
3041 } 3041 }
3042 } 3042 }
3043 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3043 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3044 fn to_owned(&self) -> TreePtr<TupleType> { TreePtr::cast(self.syntax.to_owned()) } 3044 fn to_owned(&self) -> TreeArc<TupleType> { TreeArc::cast(self.syntax.to_owned()) }
3045} 3045}
3046 3046
3047 3047
@@ -3069,7 +3069,7 @@ impl AstNode for TypeDef {
3069 } 3069 }
3070 } 3070 }
3071 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3071 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3072 fn to_owned(&self) -> TreePtr<TypeDef> { TreePtr::cast(self.syntax.to_owned()) } 3072 fn to_owned(&self) -> TreeArc<TypeDef> { TreeArc::cast(self.syntax.to_owned()) }
3073} 3073}
3074 3074
3075 3075
@@ -3098,7 +3098,7 @@ impl AstNode for TypeParam {
3098 } 3098 }
3099 } 3099 }
3100 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3100 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3101 fn to_owned(&self) -> TreePtr<TypeParam> { TreePtr::cast(self.syntax.to_owned()) } 3101 fn to_owned(&self) -> TreeArc<TypeParam> { TreeArc::cast(self.syntax.to_owned()) }
3102} 3102}
3103 3103
3104 3104
@@ -3123,7 +3123,7 @@ impl AstNode for TypeParamList {
3123 } 3123 }
3124 } 3124 }
3125 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3125 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3126 fn to_owned(&self) -> TreePtr<TypeParamList> { TreePtr::cast(self.syntax.to_owned()) } 3126 fn to_owned(&self) -> TreeArc<TypeParamList> { TreeArc::cast(self.syntax.to_owned()) }
3127} 3127}
3128 3128
3129 3129
@@ -3184,7 +3184,7 @@ impl AstNode for TypeRef {
3184 } 3184 }
3185 } 3185 }
3186 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3186 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3187 fn to_owned(&self) -> TreePtr<TypeRef> { TreePtr::cast(self.syntax.to_owned()) } 3187 fn to_owned(&self) -> TreeArc<TypeRef> { TreeArc::cast(self.syntax.to_owned()) }
3188} 3188}
3189 3189
3190impl TypeRef { 3190impl TypeRef {
@@ -3228,7 +3228,7 @@ impl AstNode for UseItem {
3228 } 3228 }
3229 } 3229 }
3230 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3230 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3231 fn to_owned(&self) -> TreePtr<UseItem> { TreePtr::cast(self.syntax.to_owned()) } 3231 fn to_owned(&self) -> TreeArc<UseItem> { TreeArc::cast(self.syntax.to_owned()) }
3232} 3232}
3233 3233
3234 3234
@@ -3256,7 +3256,7 @@ impl AstNode for UseTree {
3256 } 3256 }
3257 } 3257 }
3258 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3258 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3259 fn to_owned(&self) -> TreePtr<UseTree> { TreePtr::cast(self.syntax.to_owned()) } 3259 fn to_owned(&self) -> TreeArc<UseTree> { TreeArc::cast(self.syntax.to_owned()) }
3260} 3260}
3261 3261
3262 3262
@@ -3288,7 +3288,7 @@ impl AstNode for UseTreeList {
3288 } 3288 }
3289 } 3289 }
3290 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3290 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3291 fn to_owned(&self) -> TreePtr<UseTreeList> { TreePtr::cast(self.syntax.to_owned()) } 3291 fn to_owned(&self) -> TreeArc<UseTreeList> { TreeArc::cast(self.syntax.to_owned()) }
3292} 3292}
3293 3293
3294 3294
@@ -3316,7 +3316,7 @@ impl AstNode for Visibility {
3316 } 3316 }
3317 } 3317 }
3318 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3318 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3319 fn to_owned(&self) -> TreePtr<Visibility> { TreePtr::cast(self.syntax.to_owned()) } 3319 fn to_owned(&self) -> TreeArc<Visibility> { TreeArc::cast(self.syntax.to_owned()) }
3320} 3320}
3321 3321
3322 3322
@@ -3340,7 +3340,7 @@ impl AstNode for WhereClause {
3340 } 3340 }
3341 } 3341 }
3342 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3342 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3343 fn to_owned(&self) -> TreePtr<WhereClause> { TreePtr::cast(self.syntax.to_owned()) } 3343 fn to_owned(&self) -> TreeArc<WhereClause> { TreeArc::cast(self.syntax.to_owned()) }
3344} 3344}
3345 3345
3346 3346
@@ -3364,7 +3364,7 @@ impl AstNode for WhileExpr {
3364 } 3364 }
3365 } 3365 }
3366 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3366 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3367 fn to_owned(&self) -> TreePtr<WhileExpr> { TreePtr::cast(self.syntax.to_owned()) } 3367 fn to_owned(&self) -> TreeArc<WhileExpr> { TreeArc::cast(self.syntax.to_owned()) }
3368} 3368}
3369 3369
3370 3370
@@ -3393,7 +3393,7 @@ impl AstNode for Whitespace {
3393 } 3393 }
3394 } 3394 }
3395 fn syntax(&self) -> &SyntaxNode { &self.syntax } 3395 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3396 fn to_owned(&self) -> TreePtr<Whitespace> { TreePtr::cast(self.syntax.to_owned()) } 3396 fn to_owned(&self) -> TreeArc<Whitespace> { TreeArc::cast(self.syntax.to_owned()) }
3397} 3397}
3398 3398
3399 3399
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index 0a20fc78e..bf9db4ee8 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -15,7 +15,7 @@ use rowan::TransparentNewType;
15 15
16use crate::{ 16use crate::{
17 SyntaxNode, SyntaxKind::*, 17 SyntaxNode, SyntaxKind::*,
18 yellow::{RaTypes, TreePtr}, 18 yellow::{RaTypes, TreeArc},
19 ast::{self, AstNode}, 19 ast::{self, AstNode},
20}; 20};
21{% for node, methods in ast %} 21{% for node, methods in ast %}
@@ -48,7 +48,7 @@ impl AstNode for {{ node }} {
48 } 48 }
49 } 49 }
50 fn syntax(&self) -> &SyntaxNode { &self.syntax } 50 fn syntax(&self) -> &SyntaxNode { &self.syntax }
51 fn to_owned(&self) -> TreePtr<{{ node }}> { TreePtr::cast(self.syntax.to_owned()) } 51 fn to_owned(&self) -> TreeArc<{{ node }}> { TreeArc::cast(self.syntax.to_owned()) }
52} 52}
53 53
54impl {{ node }} { 54impl {{ node }} {
@@ -79,7 +79,7 @@ impl AstNode for {{ node }} {
79 } 79 }
80 } 80 }
81 fn syntax(&self) -> &SyntaxNode { &self.syntax } 81 fn syntax(&self) -> &SyntaxNode { &self.syntax }
82 fn to_owned(&self) -> TreePtr<{{ node }}> { TreePtr::cast(self.syntax.to_owned()) } 82 fn to_owned(&self) -> TreeArc<{{ node }}> { TreeArc::cast(self.syntax.to_owned()) }
83} 83}
84 84
85{% endif %} 85{% endif %}
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index 1dbfca91b..2a095817a 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -41,7 +41,7 @@ pub use crate::{
41 ast::AstNode, 41 ast::AstNode,
42 lexer::{tokenize, Token}, 42 lexer::{tokenize, Token},
43 syntax_kinds::SyntaxKind, 43 syntax_kinds::SyntaxKind,
44 yellow::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreePtr}, 44 yellow::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreeArc},
45}; 45};
46 46
47use ra_text_edit::AtomTextEdit; 47use ra_text_edit::AtomTextEdit;
@@ -51,29 +51,29 @@ use crate::yellow::GreenNode;
51pub use crate::ast::SourceFile; 51pub use crate::ast::SourceFile;
52 52
53impl SourceFile { 53impl SourceFile {
54 fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreePtr<SourceFile> { 54 fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SourceFile> {
55 let root = SyntaxNode::new(green, errors); 55 let root = SyntaxNode::new(green, errors);
56 if cfg!(debug_assertions) { 56 if cfg!(debug_assertions) {
57 utils::validate_block_structure(&root); 57 utils::validate_block_structure(&root);
58 } 58 }
59 assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE); 59 assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
60 TreePtr::cast(root) 60 TreeArc::cast(root)
61 } 61 }
62 pub fn parse(text: &str) -> TreePtr<SourceFile> { 62 pub fn parse(text: &str) -> TreeArc<SourceFile> {
63 let tokens = tokenize(&text); 63 let tokens = tokenize(&text);
64 let (green, errors) = 64 let (green, errors) =
65 parser_impl::parse_with(yellow::GreenBuilder::new(), text, &tokens, grammar::root); 65 parser_impl::parse_with(yellow::GreenBuilder::new(), text, &tokens, grammar::root);
66 SourceFile::new(green, errors) 66 SourceFile::new(green, errors)
67 } 67 }
68 pub fn reparse(&self, edit: &AtomTextEdit) -> TreePtr<SourceFile> { 68 pub fn reparse(&self, edit: &AtomTextEdit) -> TreeArc<SourceFile> {
69 self.incremental_reparse(edit) 69 self.incremental_reparse(edit)
70 .unwrap_or_else(|| self.full_reparse(edit)) 70 .unwrap_or_else(|| self.full_reparse(edit))
71 } 71 }
72 pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<TreePtr<SourceFile>> { 72 pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<TreeArc<SourceFile>> {
73 reparsing::incremental_reparse(self.syntax(), edit, self.errors()) 73 reparsing::incremental_reparse(self.syntax(), edit, self.errors())
74 .map(|(green_node, errors)| SourceFile::new(green_node, errors)) 74 .map(|(green_node, errors)| SourceFile::new(green_node, errors))
75 } 75 }
76 fn full_reparse(&self, edit: &AtomTextEdit) -> TreePtr<SourceFile> { 76 fn full_reparse(&self, edit: &AtomTextEdit) -> TreeArc<SourceFile> {
77 let text = edit.apply(self.syntax().text().to_string()); 77 let text = edit.apply(self.syntax().text().to_string());
78 SourceFile::parse(&text) 78 SourceFile::parse(&text)
79 } 79 }
diff --git a/crates/ra_syntax/src/validation/byte.rs b/crates/ra_syntax/src/validation/byte.rs
index 9ab4b18a3..9bddabc80 100644
--- a/crates/ra_syntax/src/validation/byte.rs
+++ b/crates/ra_syntax/src/validation/byte.rs
@@ -106,9 +106,9 @@ fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<Synt
106 106
107#[cfg(test)] 107#[cfg(test)]
108mod test { 108mod test {
109 use crate::{SourceFile, TreePtr}; 109 use crate::{SourceFile, TreeArc};
110 110
111 fn build_file(literal: &str) -> TreePtr<SourceFile> { 111 fn build_file(literal: &str) -> TreeArc<SourceFile> {
112 let src = format!("const C: u8 = b'{}';", literal); 112 let src = format!("const C: u8 = b'{}';", literal);
113 SourceFile::parse(&src) 113 SourceFile::parse(&src)
114 } 114 }
diff --git a/crates/ra_syntax/src/validation/byte_string.rs b/crates/ra_syntax/src/validation/byte_string.rs
index cd41a0a68..bdb147545 100644
--- a/crates/ra_syntax/src/validation/byte_string.rs
+++ b/crates/ra_syntax/src/validation/byte_string.rs
@@ -43,9 +43,9 @@ pub(crate) fn validate_byte_string_node(node: &ast::ByteString, errors: &mut Vec
43 43
44#[cfg(test)] 44#[cfg(test)]
45mod test { 45mod test {
46 use crate::{SourceFile, TreePtr}; 46 use crate::{SourceFile, TreeArc};
47 47
48 fn build_file(literal: &str) -> TreePtr<SourceFile> { 48 fn build_file(literal: &str) -> TreeArc<SourceFile> {
49 let src = format!(r#"const S: &'static [u8] = b"{}";"#, literal); 49 let src = format!(r#"const S: &'static [u8] = b"{}";"#, literal);
50 println!("Source: {}", src); 50 println!("Source: {}", src);
51 SourceFile::parse(&src) 51 SourceFile::parse(&src)
diff --git a/crates/ra_syntax/src/validation/char.rs b/crates/ra_syntax/src/validation/char.rs
index 169c88f56..e3ac5836b 100644
--- a/crates/ra_syntax/src/validation/char.rs
+++ b/crates/ra_syntax/src/validation/char.rs
@@ -175,9 +175,9 @@ fn validate_unicode_escape(text: &str, range: TextRange, errors: &mut Vec<Syntax
175 175
176#[cfg(test)] 176#[cfg(test)]
177mod test { 177mod test {
178 use crate::{SourceFile, TreePtr}; 178 use crate::{SourceFile, TreeArc};
179 179
180 fn build_file(literal: &str) -> TreePtr<SourceFile> { 180 fn build_file(literal: &str) -> TreeArc<SourceFile> {
181 let src = format!("const C: char = '{}';", literal); 181 let src = format!("const C: char = '{}';", literal);
182 SourceFile::parse(&src) 182 SourceFile::parse(&src)
183 } 183 }
diff --git a/crates/ra_syntax/src/validation/string.rs b/crates/ra_syntax/src/validation/string.rs
index cb86b765f..365fe8d2d 100644
--- a/crates/ra_syntax/src/validation/string.rs
+++ b/crates/ra_syntax/src/validation/string.rs
@@ -38,9 +38,9 @@ pub(crate) fn validate_string_node(node: &ast::String, errors: &mut Vec<SyntaxEr
38 38
39#[cfg(test)] 39#[cfg(test)]
40mod test { 40mod test {
41 use crate::{SourceFile, TreePtr}; 41 use crate::{SourceFile, TreeArc};
42 42
43 fn build_file(literal: &str) -> TreePtr<SourceFile> { 43 fn build_file(literal: &str) -> TreeArc<SourceFile> {
44 let src = format!(r#"const S: &'static str = "{}";"#, literal); 44 let src = format!(r#"const S: &'static str = "{}";"#, literal);
45 println!("Source: {}", src); 45 println!("Source: {}", src);
46 SourceFile::parse(&src) 46 SourceFile::parse(&src)
diff --git a/crates/ra_syntax/src/yellow.rs b/crates/ra_syntax/src/yellow.rs
index 1bf1806b9..93621d08a 100644
--- a/crates/ra_syntax/src/yellow.rs
+++ b/crates/ra_syntax/src/yellow.rs
@@ -21,23 +21,23 @@ impl Types for RaTypes {
21pub type GreenNode = rowan::GreenNode<RaTypes>; 21pub type GreenNode = rowan::GreenNode<RaTypes>;
22 22
23#[derive(PartialEq, Eq, Hash)] 23#[derive(PartialEq, Eq, Hash)]
24pub struct TreePtr<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>>( 24pub struct TreeArc<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>>(
25 pub(crate) rowan::TreePtr<RaTypes, T>, 25 pub(crate) rowan::TreeArc<RaTypes, T>,
26); 26);
27 27
28impl<T> TreePtr<T> 28impl<T> TreeArc<T>
29where 29where
30 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, 30 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>,
31{ 31{
32 pub(crate) fn cast<U>(this: TreePtr<T>) -> TreePtr<U> 32 pub(crate) fn cast<U>(this: TreeArc<T>) -> TreeArc<U>
33 where 33 where
34 U: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, 34 U: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>,
35 { 35 {
36 TreePtr(rowan::TreePtr::cast(this.0)) 36 TreeArc(rowan::TreeArc::cast(this.0))
37 } 37 }
38} 38}
39 39
40impl<T> std::ops::Deref for TreePtr<T> 40impl<T> std::ops::Deref for TreeArc<T>
41where 41where
42 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, 42 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>,
43{ 43{
@@ -47,7 +47,7 @@ where
47 } 47 }
48} 48}
49 49
50impl<T> PartialEq<T> for TreePtr<T> 50impl<T> PartialEq<T> for TreeArc<T>
51where 51where
52 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, 52 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>,
53 T: PartialEq<T>, 53 T: PartialEq<T>,
@@ -58,16 +58,16 @@ where
58 } 58 }
59} 59}
60 60
61impl<T> Clone for TreePtr<T> 61impl<T> Clone for TreeArc<T>
62where 62where
63 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, 63 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>,
64{ 64{
65 fn clone(&self) -> TreePtr<T> { 65 fn clone(&self) -> TreeArc<T> {
66 TreePtr(self.0.clone()) 66 TreeArc(self.0.clone())
67 } 67 }
68} 68}
69 69
70impl<T> fmt::Debug for TreePtr<T> 70impl<T> fmt::Debug for TreeArc<T>
71where 71where
72 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, 72 T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>,
73 T: fmt::Debug, 73 T: fmt::Debug,
@@ -85,9 +85,9 @@ unsafe impl TransparentNewType for SyntaxNode {
85} 85}
86 86
87impl SyntaxNode { 87impl SyntaxNode {
88 pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreePtr<SyntaxNode> { 88 pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> {
89 let ptr = TreePtr(rowan::SyntaxNode::new(green, errors)); 89 let ptr = TreeArc(rowan::SyntaxNode::new(green, errors));
90 TreePtr::cast(ptr) 90 TreeArc::cast(ptr)
91 } 91 }
92} 92}
93 93
@@ -131,9 +131,9 @@ impl SyntaxNode {
131 pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode { 131 pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode {
132 self.0.replace_self(replacement) 132 self.0.replace_self(replacement)
133 } 133 }
134 pub fn to_owned(&self) -> TreePtr<SyntaxNode> { 134 pub fn to_owned(&self) -> TreeArc<SyntaxNode> {
135 let ptr = TreePtr(self.0.to_owned()); 135 let ptr = TreeArc(self.0.to_owned());
136 TreePtr::cast(ptr) 136 TreeArc::cast(ptr)
137 } 137 }
138 pub fn kind(&self) -> SyntaxKind { 138 pub fn kind(&self) -> SyntaxKind {
139 self.0.kind() 139 self.0.kind()