Remove ModData
from rustc_metadata
This avoids having to decode 2 `Lazy`s when decoding a modules exports.
This commit is contained in:
parent
fabede1851
commit
d8426ea636
@ -1198,8 +1198,8 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
if let EntryKind::Mod(data) = kind {
|
||||
for exp in data.decode((self, sess)).reexports.decode((self, sess)) {
|
||||
if let EntryKind::Mod(exports) = kind {
|
||||
for exp in exports.decode((self, sess)) {
|
||||
match exp.res {
|
||||
Res::Def(DefKind::Macro(..), _) => {}
|
||||
_ if macros_only => continue,
|
||||
|
@ -1086,9 +1086,7 @@ impl EncodeContext<'a, 'tcx> {
|
||||
Lazy::empty()
|
||||
};
|
||||
|
||||
let data = ModData { reexports };
|
||||
|
||||
record!(self.tables.kind[def_id] <- EntryKind::Mod(self.lazy(data)));
|
||||
record!(self.tables.kind[def_id] <- EntryKind::Mod(reexports));
|
||||
if self.is_proc_macro {
|
||||
record!(self.tables.children[def_id] <- &[]);
|
||||
// Encode this here because we don't do it in encode_def_ids.
|
||||
|
@ -346,7 +346,7 @@ enum EntryKind {
|
||||
Union(Lazy<VariantData>, ReprOptions),
|
||||
Fn(Lazy<FnData>),
|
||||
ForeignFn(Lazy<FnData>),
|
||||
Mod(Lazy<ModData>),
|
||||
Mod(Lazy<[Export]>),
|
||||
MacroDef(Lazy<MacroDef>),
|
||||
ProcMacro(MacroKind),
|
||||
Closure,
|
||||
@ -364,11 +364,6 @@ enum EntryKind {
|
||||
#[derive(Encodable, Decodable)]
|
||||
struct RenderedConst(String);
|
||||
|
||||
#[derive(MetadataEncodable, MetadataDecodable)]
|
||||
struct ModData {
|
||||
reexports: Lazy<[Export]>,
|
||||
}
|
||||
|
||||
#[derive(MetadataEncodable, MetadataDecodable)]
|
||||
struct FnData {
|
||||
asyncness: hir::IsAsync,
|
||||
|
@ -145,12 +145,11 @@ impl<'a> Resolver<'a> {
|
||||
} else {
|
||||
def_key.disambiguated_data.data.get_opt_name().expect("module without name")
|
||||
};
|
||||
let expn_id = self.cstore().module_expansion_untracked(def_id, &self.session);
|
||||
|
||||
Some(self.new_module(
|
||||
parent,
|
||||
ModuleKind::Def(def_kind, def_id, name),
|
||||
expn_id,
|
||||
self.cstore().module_expansion_untracked(def_id, &self.session),
|
||||
self.cstore().get_span_untracked(def_id, &self.session),
|
||||
// FIXME: Account for `#[no_implicit_prelude]` attributes.
|
||||
parent.map_or(false, |module| module.no_implicit_prelude),
|
||||
|
Loading…
x
Reference in New Issue
Block a user