aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres')
-rw-r--r--crates/hir_def/src/nameres/collector.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index b5ae5a9e4..d0fefb5af 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -242,7 +242,7 @@ struct DefCollector<'a> {
242impl DefCollector<'_> { 242impl DefCollector<'_> {
243 fn seed_with_top_level(&mut self) { 243 fn seed_with_top_level(&mut self) {
244 let file_id = self.db.crate_graph()[self.def_map.krate].root_file_id; 244 let file_id = self.db.crate_graph()[self.def_map.krate].root_file_id;
245 let item_tree = self.db.item_tree(file_id.into()); 245 let item_tree = self.db.file_item_tree(file_id.into());
246 let module_id = self.def_map.root; 246 let module_id = self.def_map.root;
247 self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; 247 self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id };
248 if item_tree 248 if item_tree
@@ -263,7 +263,7 @@ impl DefCollector<'_> {
263 } 263 }
264 264
265 fn seed_with_inner(&mut self, block: AstId<ast::BlockExpr>) { 265 fn seed_with_inner(&mut self, block: AstId<ast::BlockExpr>) {
266 let item_tree = self.db.item_tree(block.file_id); 266 let item_tree = self.db.file_item_tree(block.file_id);
267 let module_id = self.def_map.root; 267 let module_id = self.def_map.root;
268 self.def_map.modules[module_id].origin = ModuleOrigin::BlockExpr { block }; 268 self.def_map.modules[module_id].origin = ModuleOrigin::BlockExpr { block };
269 if item_tree 269 if item_tree
@@ -895,7 +895,7 @@ impl DefCollector<'_> {
895 } 895 }
896 896
897 // Then, fetch and process the item tree. This will reuse the expansion result from above. 897 // Then, fetch and process the item tree. This will reuse the expansion result from above.
898 let item_tree = self.db.item_tree(file_id); 898 let item_tree = self.db.file_item_tree(file_id);
899 let mod_dir = self.mod_dirs[&module_id].clone(); 899 let mod_dir = self.mod_dirs[&module_id].clone();
900 ModCollector { 900 ModCollector {
901 def_collector: &mut *self, 901 def_collector: &mut *self,
@@ -951,21 +951,21 @@ impl DefCollector<'_> {
951 let mut diagnosed_extern_crates = FxHashSet::default(); 951 let mut diagnosed_extern_crates = FxHashSet::default();
952 for directive in &self.unresolved_imports { 952 for directive in &self.unresolved_imports {
953 if let ImportSource::ExternCrate(krate) = directive.import.source { 953 if let ImportSource::ExternCrate(krate) = directive.import.source {
954 let item_tree = self.db.item_tree(krate.file_id); 954 let item_tree = krate.item_tree(self.db);
955 let extern_crate = &item_tree[krate.value]; 955 let extern_crate = &item_tree[krate.value];
956 956
957 diagnosed_extern_crates.insert(extern_crate.name.clone()); 957 diagnosed_extern_crates.insert(extern_crate.name.clone());
958 958
959 self.def_map.diagnostics.push(DefDiagnostic::unresolved_extern_crate( 959 self.def_map.diagnostics.push(DefDiagnostic::unresolved_extern_crate(
960 directive.module_id, 960 directive.module_id,
961 InFile::new(krate.file_id, extern_crate.ast_id), 961 InFile::new(krate.file_id(), extern_crate.ast_id),
962 )); 962 ));
963 } 963 }
964 } 964 }
965 965
966 for directive in &self.unresolved_imports { 966 for directive in &self.unresolved_imports {
967 if let ImportSource::Import(import) = &directive.import.source { 967 if let ImportSource::Import(import) = &directive.import.source {
968 let item_tree = self.db.item_tree(import.file_id); 968 let item_tree = import.item_tree(self.db);
969 let import_data = &item_tree[import.value]; 969 let import_data = &item_tree[import.value];
970 970
971 match (import_data.path.segments().first(), &import_data.path.kind) { 971 match (import_data.path.segments().first(), &import_data.path.kind) {
@@ -979,7 +979,7 @@ impl DefCollector<'_> {
979 979
980 self.def_map.diagnostics.push(DefDiagnostic::unresolved_import( 980 self.def_map.diagnostics.push(DefDiagnostic::unresolved_import(
981 directive.module_id, 981 directive.module_id,
982 InFile::new(import.file_id, import_data.ast_id), 982 InFile::new(import.file_id(), import_data.ast_id),
983 import_data.index, 983 import_data.index,
984 )); 984 ));
985 } 985 }
@@ -1055,7 +1055,7 @@ impl ModCollector<'_, '_> {
1055 self.def_collector.db, 1055 self.def_collector.db,
1056 krate, 1056 krate,
1057 &self.item_tree, 1057 &self.item_tree,
1058 InFile::new(self.file_id, import_id), 1058 ItemTreeId::new(self.file_id, import_id),
1059 ), 1059 ),
1060 status: PartialResolvedImport::Unresolved, 1060 status: PartialResolvedImport::Unresolved,
1061 }) 1061 })
@@ -1067,7 +1067,7 @@ impl ModCollector<'_, '_> {
1067 self.def_collector.db, 1067 self.def_collector.db,
1068 krate, 1068 krate,
1069 &self.item_tree, 1069 &self.item_tree,
1070 InFile::new(self.file_id, import_id), 1070 ItemTreeId::new(self.file_id, import_id),
1071 ), 1071 ),
1072 status: PartialResolvedImport::Unresolved, 1072 status: PartialResolvedImport::Unresolved,
1073 }) 1073 })
@@ -1299,7 +1299,7 @@ impl ModCollector<'_, '_> {
1299 Some((file_id, is_mod_rs)), 1299 Some((file_id, is_mod_rs)),
1300 &self.item_tree[module.visibility], 1300 &self.item_tree[module.visibility],
1301 ); 1301 );
1302 let item_tree = db.item_tree(file_id.into()); 1302 let item_tree = db.file_item_tree(file_id.into());
1303 ModCollector { 1303 ModCollector {
1304 def_collector: &mut *self.def_collector, 1304 def_collector: &mut *self.def_collector,
1305 macro_depth: self.macro_depth, 1305 macro_depth: self.macro_depth,