aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs2
-rw-r--r--crates/ra_hir/src/expr/validation.rs3
-rw-r--r--crates/ra_hir/src/ids.rs2
-rw-r--r--crates/ra_hir/src/source_binder.rs4
4 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 805357662..4fb5844f4 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -167,7 +167,7 @@ impl ModuleSource {
167 ) -> ModuleSource { 167 ) -> ModuleSource {
168 match (file_id, decl_id) { 168 match (file_id, decl_id) {
169 (Some(file_id), _) => { 169 (Some(file_id), _) => {
170 let source_file = db.parse(file_id).tree; 170 let source_file = db.parse(file_id).tree().to_owned();
171 ModuleSource::SourceFile(source_file) 171 ModuleSource::SourceFile(source_file)
172 } 172 }
173 (None, Some(item_id)) => { 173 (None, Some(item_id)) => {
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs
index 4e6131dce..c2a10a0b5 100644
--- a/crates/ra_hir/src/expr/validation.rs
+++ b/crates/ra_hir/src/expr/validation.rs
@@ -71,7 +71,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
71 } 71 }
72 let source_map = self.func.body_source_map(db); 72 let source_map = self.func.body_source_map(db);
73 let file_id = self.func.source(db).file_id; 73 let file_id = self.func.source(db).file_id;
74 let source_file = db.parse(file_id.original_file(db)).tree; 74 let parse = db.parse(file_id.original_file(db));
75 let source_file = parse.tree();
75 if let Some(field_list_node) = source_map 76 if let Some(field_list_node) = source_map
76 .expr_syntax(id) 77 .expr_syntax(id)
77 .map(|ptr| ptr.to_node(source_file.syntax())) 78 .map(|ptr| ptr.to_node(source_file.syntax()))
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 5212b78ac..80e9cccd6 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -60,7 +60,7 @@ impl HirFileId {
60 file_id: HirFileId, 60 file_id: HirFileId,
61 ) -> Option<TreeArc<SyntaxNode>> { 61 ) -> Option<TreeArc<SyntaxNode>> {
62 match file_id.0 { 62 match file_id.0 {
63 HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree.syntax().to_owned()), 63 HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree().syntax().to_owned()),
64 HirFileIdRepr::Macro(macro_file) => db.parse_macro(macro_file), 64 HirFileIdRepr::Macro(macro_file) => db.parse_macro(macro_file),
65 } 65 }
66 } 66 }
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 429575fee..573add7da 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -49,8 +49,8 @@ pub fn module_from_declaration(
49 49
50/// Locates the module by position in the source code. 50/// Locates the module by position in the source code.
51pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { 51pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> {
52 let file = db.parse(position.file_id).tree; 52 let parse = db.parse(position.file_id);
53 match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { 53 match find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) {
54 Some(m) if !m.has_semi() => module_from_inline(db, position.file_id, m), 54 Some(m) if !m.has_semi() => module_from_inline(db, position.file_id, m),
55 _ => module_from_file_id(db, position.file_id), 55 _ => module_from_file_id(db, position.file_id),
56 } 56 }