diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-18 20:12:11 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-18 20:12:11 +0000 |
commit | 0791c8e44c6fd1e7519df003dcb8c9e156916f46 (patch) | |
tree | 28468414f1ba4183859ebdf78c31f23b87ebda96 /crates/hir_ty | |
parent | 8164e2ea31ed0c169bc295acb6e13650576e5366 (diff) | |
parent | 57a82fb05b46fd028c0b971dc6ce317db3682146 (diff) |
Merge #7336
7336: Rename `CrateDefMap` to `DefMap` r=matklad a=jonas-schievink
I propose handling local items by computing a `DefMap` for every block expression, using the regular (early) name resolution algorithm. The result of that will be a `DefMap` that has a reference to the parent `DefMap`, which is either the one computed for the containing block expression, or the crate's root `DefMap`. Name resolution will fall back to a name in the parent `DefMap` if it cannot be resolved in the inner block.
The `DefMap`s computed for block expressions will go through a separate query that can be garbage-collected much more aggressively, since these `DefMap`s should be cheap to compute and are never part of a crate's public API.
The first step towards that is to make `CrateDefMap` not specific to crates anymore, hence this rename (if this plans sounds reasonable).
cc https://github.com/rust-analyzer/rust-analyzer/issues/7325 and https://github.com/rust-analyzer/rust-analyzer/issues/1165
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/tests.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs index 5ff755321..4a3fcea8d 100644 --- a/crates/hir_ty/src/tests.rs +++ b/crates/hir_ty/src/tests.rs | |||
@@ -18,7 +18,7 @@ use hir_def::{ | |||
18 | db::DefDatabase, | 18 | db::DefDatabase, |
19 | item_scope::ItemScope, | 19 | item_scope::ItemScope, |
20 | keys, | 20 | keys, |
21 | nameres::CrateDefMap, | 21 | nameres::DefMap, |
22 | AssocItemId, DefWithBodyId, LocalModuleId, Lookup, ModuleDefId, | 22 | AssocItemId, DefWithBodyId, LocalModuleId, Lookup, ModuleDefId, |
23 | }; | 23 | }; |
24 | use hir_expand::{db::AstDatabase, InFile}; | 24 | use hir_expand::{db::AstDatabase, InFile}; |
@@ -221,7 +221,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { | |||
221 | 221 | ||
222 | fn visit_module( | 222 | fn visit_module( |
223 | db: &TestDB, | 223 | db: &TestDB, |
224 | crate_def_map: &CrateDefMap, | 224 | crate_def_map: &DefMap, |
225 | module_id: LocalModuleId, | 225 | module_id: LocalModuleId, |
226 | cb: &mut dyn FnMut(DefWithBodyId), | 226 | cb: &mut dyn FnMut(DefWithBodyId), |
227 | ) { | 227 | ) { |
@@ -249,7 +249,7 @@ fn visit_module( | |||
249 | 249 | ||
250 | fn visit_scope( | 250 | fn visit_scope( |
251 | db: &TestDB, | 251 | db: &TestDB, |
252 | crate_def_map: &CrateDefMap, | 252 | crate_def_map: &DefMap, |
253 | scope: &ItemScope, | 253 | scope: &ItemScope, |
254 | cb: &mut dyn FnMut(DefWithBodyId), | 254 | cb: &mut dyn FnMut(DefWithBodyId), |
255 | ) { | 255 | ) { |