resolve: Refactor obtaining Module from its DefId

The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not.
Non-local traits and enums are also correctly found now.
This commit is contained in:
Vadim Petrochenkov 2021-09-12 02:06:27 +03:00
parent a8021888c8
commit ab834e5ea9
6 changed files with 76 additions and 78 deletions

View file

@ -240,7 +240,7 @@ impl<'a> ResolverExpand for Resolver<'a> {
);
let parent_scope =
parent_module.map_or(self.empty_module, |def_id| self.get_module(def_id));
parent_module.map_or(self.empty_module, |def_id| self.expect_module(def_id));
self.ast_transform_scopes.insert(expn_id, parent_scope);
expn_id