From 89360931f23a512d76559a796cdbd74b6681c46e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 16 Jan 2021 23:14:42 +0100 Subject: [PATCH] Fix proc macro crate encoding. --- compiler/rustc_metadata/src/rmeta/encoder.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 23329acffd9..3961adaceca 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1613,12 +1613,19 @@ impl EncodeContext<'a, 'tcx> { let tcx = self.tcx; let hir = tcx.hir(); - record!(self.tables.span[LOCAL_CRATE.as_def_id()] <- hir.span(hir::CRATE_HIR_ID)); - let proc_macro_decls_static = tcx.proc_macro_decls_static(LOCAL_CRATE).unwrap().index; let stability = tcx.lookup_stability(DefId::local(CRATE_DEF_INDEX)).copied(); let macros = self.lazy(hir.krate().proc_macros.iter().map(|p| p.owner.local_def_index)); + record!(self.tables.def_kind[LOCAL_CRATE.as_def_id()] <- DefKind::Mod); + record!(self.tables.span[LOCAL_CRATE.as_def_id()] <- tcx.def_span(LOCAL_CRATE.as_def_id())); + record!(self.tables.attributes[LOCAL_CRATE.as_def_id()] <- tcx.get_attrs(LOCAL_CRATE.as_def_id())); + record!(self.tables.visibility[LOCAL_CRATE.as_def_id()] <- tcx.visibility(LOCAL_CRATE.as_def_id())); + if let Some(stability) = stability { + record!(self.tables.stability[LOCAL_CRATE.as_def_id()] <- stability); + } + self.encode_deprecation(LOCAL_CRATE.as_def_id()); + // Normally, this information is encoded when we walk the items // defined in this crate. However, we skip doing that for proc-macro crates, // so we manually encode just the information that we need