resolve: Use a single common map for local and foreign modules

This commit is contained in:
Vadim Petrochenkov
2021-09-12 01:59:05 +03:00
parent 1a23858983
commit a8021888c8
4 changed files with 13 additions and 20 deletions

View File

@@ -799,9 +799,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
}
fn with_scope<T>(&mut self, id: NodeId, f: impl FnOnce(&mut Self) -> T) -> T {
let id = self.r.local_def_id(id);
let module = self.r.module_map.get(&id).cloned(); // clones a reference
if let Some(module) = module {
if let Some(module) = self.r.module_map.get(&self.r.local_def_id(id).to_def_id()).copied() {
// Move down in the graph.
let orig_module = replace(&mut self.parent_scope.module, module);
self.with_rib(ValueNS, ModuleRibKind(module), |this| {