Handle cross-crate module ExpnIds consistently

- Always use the ExpnId serialized to `tables`
- Use the Id for traits and enums from other crates in resolution.
This commit is contained in:
Matthew Jasper 2021-10-21 22:06:40 +01:00
parent 547a6ffee0
commit 4ecb49eba3
6 changed files with 13 additions and 12 deletions

View file

@ -145,12 +145,7 @@ impl<'a> Resolver<'a> {
} else {
def_key.disambiguated_data.data.get_opt_name().expect("module without name")
};
let expn_id = if def_kind == DefKind::Mod {
self.cstore().module_expansion_untracked(def_id, &self.session)
} else {
// FIXME: Parent expansions for enums and traits are not kept in metadata.
ExpnId::root()
};
let expn_id = self.cstore().module_expansion_untracked(def_id, &self.session);
Some(self.new_module(
parent,