diff options
author | Jonas Schievink <[email protected]> | 2021-03-12 23:34:01 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-18 00:53:22 +0000 |
commit | 759f8c83e53bb72804cb4c578a01b09fc2dcf4fa (patch) | |
tree | e8fad4c250ba1c9578065f5781ecdfd3c282f437 /crates/hir_def/src/nameres | |
parent | 5632e61f79ff8827816ccfab9f01ce2e349f3144 (diff) |
Make `ItemTreeId` its own type
Diffstat (limited to 'crates/hir_def/src/nameres')
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index b5ae5a9e4..7ca4299b9 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -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 | }) |