diff options
Diffstat (limited to 'compiler/rustc_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/foreign_modules.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/lib.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/link_args.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/native_libs.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder.rs | 166 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 57 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/mod.rs | 2 |
8 files changed, 160 insertions, 105 deletions
diff --git a/compiler/rustc_metadata/src/foreign_modules.rs b/compiler/rustc_metadata/src/foreign_modules.rs index 8675197656a..4785b6c379c 100644 --- a/compiler/rustc_metadata/src/foreign_modules.rs +++ b/compiler/rustc_metadata/src/foreign_modules.rs @@ -16,13 +16,13 @@ struct Collector<'tcx> { impl ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) { - let fm = match it.kind { - hir::ItemKind::ForeignMod(ref fm) => fm, + let items = match it.kind { + hir::ItemKind::ForeignMod { items, .. } => items, _ => return, }; let foreign_items = - fm.items.iter().map(|it| self.tcx.hir().local_def_id(it.hir_id).to_def_id()).collect(); + items.iter().map(|it| self.tcx.hir().local_def_id(it.id.hir_id).to_def_id()).collect(); self.modules.push(ForeignModule { foreign_items, def_id: self.tcx.hir().local_def_id(it.hir_id).to_def_id(), @@ -31,4 +31,5 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_trait_item(&mut self, _it: &'tcx hir::TraitItem<'tcx>) {} fn visit_impl_item(&mut self, _it: &'tcx hir::ImplItem<'tcx>) {} + fn visit_foreign_item(&mut self, _it: &'tcx hir::ForeignItem<'tcx>) {} } diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index 77766be7397..2560cfa7462 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -1,5 +1,4 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] -#![feature(bool_to_option)] #![feature(core_intrinsics)] #![feature(crate_visibility_modifier)] #![feature(drain_filter)] diff --git a/compiler/rustc_metadata/src/link_args.rs b/compiler/rustc_metadata/src/link_args.rs index d8f16796083..d088288c507 100644 --- a/compiler/rustc_metadata/src/link_args.rs +++ b/compiler/rustc_metadata/src/link_args.rs @@ -26,11 +26,11 @@ struct Collector<'tcx> { impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) { - let fm = match it.kind { - hir::ItemKind::ForeignMod(ref fm) => fm, + let abi = match it.kind { + hir::ItemKind::ForeignMod { abi, .. } => abi, _ => return, }; - if fm.abi == Abi::Rust || fm.abi == Abi::RustIntrinsic || fm.abi == Abi::PlatformIntrinsic { + if abi == Abi::Rust || abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic { return; } @@ -45,6 +45,7 @@ impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_trait_item(&mut self, _it: &'tcx hir::TraitItem<'tcx>) {} fn visit_impl_item(&mut self, _it: &'tcx hir::ImplItem<'tcx>) {} + fn visit_foreign_item(&mut self, _it: &'tcx hir::ForeignItem<'tcx>) {} } impl<'tcx> Collector<'tcx> { diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 2f7c2c2c405..fe29f9d177f 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -33,12 +33,12 @@ struct Collector<'tcx> { impl ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) { - let fm = match it.kind { - hir::ItemKind::ForeignMod(ref fm) => fm, + let abi = match it.kind { + hir::ItemKind::ForeignMod { abi, .. } => abi, _ => return, }; - if fm.abi == Abi::Rust || fm.abi == Abi::RustIntrinsic || fm.abi == Abi::PlatformIntrinsic { + if abi == Abi::Rust || abi == Abi::RustIntrinsic || abi == Abi::PlatformIntrinsic { return; } @@ -127,6 +127,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_trait_item(&mut self, _it: &'tcx hir::TraitItem<'tcx>) {} fn visit_impl_item(&mut self, _it: &'tcx hir::ImplItem<'tcx>) {} + fn visit_foreign_item(&mut self, _it: &'tcx hir::ForeignItem<'tcx>) {} } impl Collector<'tcx> { diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index a1df1a63fc5..43f7b2a9928 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -77,6 +77,10 @@ crate struct CrateMetadata { raw_proc_macros: Option<&'static [ProcMacro]>, /// Source maps for code from the crate. source_map_import_info: OnceCell<Vec<ImportedSourceFile>>, + /// For every definition in this crate, maps its `DefPathHash` to its + /// `DefIndex`. See `raw_def_id_to_def_id` for more details about how + /// this is used. + def_path_hash_map: OnceCell<FxHashMap<DefPathHash, DefIndex>>, /// Used for decoding interpret::AllocIds in a cached & thread-safe manner. alloc_decoding_state: AllocDecodingState, /// The `DepNodeIndex` of the `DepNode` representing this upstream crate. @@ -644,6 +648,7 @@ impl EntryKind { EntryKind::TraitAlias => DefKind::TraitAlias, EntryKind::Enum(..) => DefKind::Enum, EntryKind::MacroDef(_) => DefKind::Macro(MacroKind::Bang), + EntryKind::ProcMacro(kind) => DefKind::Macro(kind), EntryKind::ForeignType => DefKind::ForeignTy, EntryKind::Impl(_) => DefKind::Impl, EntryKind::Closure => DefKind::Closure, @@ -685,20 +690,11 @@ impl CrateRoot<'_> { } impl<'a, 'tcx> CrateMetadataRef<'a> { - fn is_proc_macro(&self, id: DefIndex) -> bool { - self.root - .proc_macro_data - .as_ref() - .and_then(|data| data.macros.decode(self).find(|x| *x == id)) - .is_some() - } - fn maybe_kind(&self, item_id: DefIndex) -> Option<EntryKind> { self.root.tables.kind.get(self, item_id).map(|k| k.decode(self)) } fn kind(&self, item_id: DefIndex) -> EntryKind { - assert!(!self.is_proc_macro(item_id)); self.maybe_kind(item_id).unwrap_or_else(|| { bug!( "CrateMetadata::kind({:?}): id not found, in crate {:?} with number {}", @@ -725,35 +721,24 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } fn item_ident(&self, item_index: DefIndex, sess: &Session) -> Ident { - if !self.is_proc_macro(item_index) { - let name = self - .def_key(item_index) - .disambiguated_data - .data - .get_opt_name() - .expect("no name in item_ident"); - let span = self - .root - .tables - .ident_span - .get(self, item_index) - .map(|data| data.decode((self, sess))) - .unwrap_or_else(|| panic!("Missing ident span for {:?} ({:?})", name, item_index)); - Ident::new(name, span) - } else { - Ident::new( - Symbol::intern(self.raw_proc_macro(item_index).name()), - self.get_span(item_index, sess), - ) - } + let name = self + .def_key(item_index) + .disambiguated_data + .data + .get_opt_name() + .expect("no name in item_ident"); + let span = self + .root + .tables + .ident_span + .get(self, item_index) + .map(|data| data.decode((self, sess))) + .unwrap_or_else(|| panic!("Missing ident span for {:?} ({:?})", name, item_index)); + Ident::new(name, span) } fn def_kind(&self, index: DefIndex) -> DefKind { - if !self.is_proc_macro(index) { - self.kind(index).def_kind() - } else { - DefKind::Macro(macro_kind(self.raw_proc_macro(index))) - } + self.kind(index).def_kind() } fn get_span(&self, index: DefIndex, sess: &Session) -> Span { @@ -947,14 +932,16 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { - self.root.tables.ty.get(self, id).unwrap().decode((self, tcx)) + self.root + .tables + .ty + .get(self, id) + .unwrap_or_else(|| panic!("Not a type: {:?}", id)) + .decode((self, tcx)) } fn get_stability(&self, id: DefIndex) -> Option<attr::Stability> { - match self.is_proc_macro(id) { - true => self.root.proc_macro_data.as_ref().unwrap().stability, - false => self.root.tables.stability.get(self, id).map(|stab| stab.decode(self)), - } + self.root.tables.stability.get(self, id).map(|stab| stab.decode(self)) } fn get_const_stability(&self, id: DefIndex) -> Option<attr::ConstStability> { @@ -962,19 +949,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } fn get_deprecation(&self, id: DefIndex) -> Option<attr::Deprecation> { - self.root - .tables - .deprecation - .get(self, id) - .filter(|_| !self.is_proc_macro(id)) - .map(|depr| depr.decode(self)) + self.root.tables.deprecation.get(self, id).map(|depr| depr.decode(self)) } fn get_visibility(&self, id: DefIndex) -> ty::Visibility { - match self.is_proc_macro(id) { - true => ty::Visibility::Public, - false => self.root.tables.visibility.get(self, id).unwrap().decode(self), - } + self.root.tables.visibility.get(self, id).unwrap().decode(self) } fn get_impl_data(&self, id: DefIndex) -> ImplData { @@ -1186,7 +1165,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } fn is_item_mir_available(&self, id: DefIndex) -> bool { - !self.is_proc_macro(id) && self.root.tables.mir.get(self, id).is_some() + self.root.tables.mir.get(self, id).is_some() } fn module_expansion(&self, id: DefIndex, sess: &Session) -> ExpnId { @@ -1202,7 +1181,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { .tables .mir .get(self, id) - .filter(|_| !self.is_proc_macro(id)) .unwrap_or_else(|| { bug!("get_optimized_mir: missing MIR for `{:?}`", self.local_def_id(id)) }) @@ -1218,7 +1196,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { .tables .mir_abstract_consts .get(self, id) - .filter(|_| !self.is_proc_macro(id)) .map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx))))) } @@ -1227,7 +1204,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { .tables .unused_generic_params .get(self, id) - .filter(|_| !self.is_proc_macro(id)) .map(|params| params.decode(self)) .unwrap_or_default() } @@ -1237,7 +1213,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { .tables .promoted_mir .get(self, id) - .filter(|_| !self.is_proc_macro(id)) .unwrap_or_else(|| { bug!("get_promoted_mir: missing MIR for `{:?}`", self.local_def_id(id)) }) @@ -1541,14 +1516,63 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { #[inline] fn def_key(&self, index: DefIndex) -> DefKey { - *self.def_key_cache.lock().entry(index).or_insert_with(|| { - let mut key = self.root.tables.def_keys.get(self, index).unwrap().decode(self); - if self.is_proc_macro(index) { - let name = self.raw_proc_macro(index).name(); - key.disambiguated_data.data = DefPathData::MacroNs(Symbol::intern(name)); + *self + .def_key_cache + .lock() + .entry(index) + .or_insert_with(|| self.root.tables.def_keys.get(self, index).unwrap().decode(self)) + } + + /// Finds the corresponding `DefId` for the provided `DefPathHash`, if it exists. + /// This is used by incremental compilation to map a serialized `DefPathHash` to + /// its `DefId` in the current session. + /// Normally, only one 'main' crate will change between incremental compilation sessions: + /// all dependencies will be completely unchanged. In this case, we can avoid + /// decoding every `DefPathHash` in the crate, since the `DefIndex` from the previous + /// session will still be valid. If our 'guess' is wrong (the `DefIndex` no longer exists, + /// or has a different `DefPathHash`, then we need to decode all `DefPathHashes` to determine + /// the correct mapping). + fn def_path_hash_to_def_id( + &self, + krate: CrateNum, + index_guess: u32, + hash: DefPathHash, + ) -> Option<DefId> { + let def_index_guess = DefIndex::from_u32(index_guess); + let old_hash = self + .root + .tables + .def_path_hashes + .get(self, def_index_guess) + .map(|lazy| lazy.decode(self)); + + // Fast path: the definition and its index is unchanged from the + // previous compilation session. There is no need to decode anything + // else + if old_hash == Some(hash) { + return Some(DefId { krate, index: def_index_guess }); + } + + let is_proc_macro = self.is_proc_macro_crate(); + + // Slow path: We need to find out the new `DefIndex` of the provided + // `DefPathHash`, if its still exists. This requires decoding every `DefPathHash` + // stored in this crate. + let map = self.cdata.def_path_hash_map.get_or_init(|| { + let end_id = self.root.tables.def_path_hashes.size() as u32; + let mut map = FxHashMap::with_capacity_and_hasher(end_id as usize, Default::default()); + for i in 0..end_id { + let def_index = DefIndex::from_u32(i); + // There may be gaps in the encoded table if we're decoding a proc-macro crate + if let Some(hash) = self.root.tables.def_path_hashes.get(self, def_index) { + map.insert(hash.decode(self), def_index); + } else if !is_proc_macro { + panic!("Missing def_path_hashes entry for {:?}", def_index); + } } - key - }) + map + }); + map.get(&hash).map(|index| DefId { krate, index: *index }) } // Returns the path leading to the thing with this `id`. @@ -1573,23 +1597,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { self.def_path_hash_unlocked(index, &mut def_path_hashes) } - fn all_def_path_hashes_and_def_ids(&self) -> Vec<(DefPathHash, DefId)> { - let mut def_path_hashes = self.def_path_hash_cache.lock(); - let mut def_index_to_data = |index| { - (self.def_path_hash_unlocked(index, &mut def_path_hashes), self.local_def_id(index)) - }; - if let Some(data) = &self.root.proc_macro_data { - std::iter::once(CRATE_DEF_INDEX) - .chain(data.macros.decode(self)) - .map(def_index_to_data) - .collect() - } else { - (0..self.num_def_ids()) - .map(|index| def_index_to_data(DefIndex::from_usize(index))) - .collect() - } - } - /// Get the `DepNodeIndex` corresponding this crate. The result of this /// method is cached in the `dep_node_index` field. fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex { @@ -1829,6 +1836,7 @@ impl CrateMetadata { trait_impls, raw_proc_macros, source_map_import_info: OnceCell::new(), + def_path_hash_map: Default::default(), alloc_decoding_state, dep_node_index: AtomicCell::new(DepNodeIndex::INVALID), cnum, diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 85dc60d7eed..b7f22885217 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -456,6 +456,10 @@ impl CStore { pub fn module_expansion_untracked(&self, def_id: DefId, sess: &Session) -> ExpnId { self.get_crate_data(def_id.krate).module_expansion(def_id.index, sess) } + + pub fn num_def_ids(&self, cnum: CrateNum) -> usize { + self.get_crate_data(cnum).num_def_ids() + } } impl CrateStore for CStore { @@ -498,12 +502,14 @@ impl CrateStore for CStore { self.get_crate_data(def.krate).def_path_hash(def.index) } - fn all_def_path_hashes_and_def_ids(&self, cnum: CrateNum) -> Vec<(DefPathHash, DefId)> { - self.get_crate_data(cnum).all_def_path_hashes_and_def_ids() - } - - fn num_def_ids(&self, cnum: CrateNum) -> usize { - self.get_crate_data(cnum).num_def_ids() + // See `CrateMetadataRef::def_path_hash_to_def_id` for more details + fn def_path_hash_to_def_id( + &self, + cnum: CrateNum, + index_guess: u32, + hash: DefPathHash, + ) -> Option<DefId> { + self.get_crate_data(cnum).def_path_hash_to_def_id(cnum, index_guess, hash) } fn crates_untracked(&self) -> Vec<CrateNum> { diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index a7cf1079b8f..46dd0df65e0 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -9,6 +9,7 @@ use rustc_data_structures::sync::{join, Lrc}; use rustc_hir as hir; use rustc_hir::def::CtorKind; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::definitions::DefPathData; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_hir::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor}; use rustc_hir::lang_items; @@ -27,7 +28,7 @@ use rustc_middle::ty::codec::TyEncoder; use rustc_middle::ty::{self, SymbolName, Ty, TyCtxt}; use rustc_serialize::{opaque, Encodable, Encoder}; use rustc_session::config::CrateType; -use rustc_span::hygiene::{ExpnDataEncodeMode, HygieneEncodeContext}; +use rustc_span::hygiene::{ExpnDataEncodeMode, HygieneEncodeContext, MacroKind}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::{self, ExternalSource, FileName, SourceFile, Span, SyntaxContext}; use rustc_target::abi::VariantIdx; @@ -1225,7 +1226,7 @@ impl EncodeContext<'a, 'tcx> { hir::ItemKind::Mod(ref m) => { return self.encode_info_for_mod(item.hir_id, m, &item.attrs); } - hir::ItemKind::ForeignMod(_) => EntryKind::ForeignMod, + hir::ItemKind::ForeignMod { .. } => EntryKind::ForeignMod, hir::ItemKind::GlobalAsm(..) => EntryKind::GlobalAsm, hir::ItemKind::TyAlias(..) => EntryKind::Type, hir::ItemKind::OpaqueTy(..) => { @@ -1320,11 +1321,11 @@ impl EncodeContext<'a, 'tcx> { record!(self.tables.expn_that_defined[def_id] <- self.tcx.expansion_that_defined(def_id)); // FIXME(eddyb) there should be a nicer way to do this. match item.kind { - hir::ItemKind::ForeignMod(ref fm) => record!(self.tables.children[def_id] <- - fm.items + hir::ItemKind::ForeignMod { items, .. } => record!(self.tables.children[def_id] <- + items .iter() .map(|foreign_item| tcx.hir().local_def_id( - foreign_item.hir_id).local_def_index) + foreign_item.id.hir_id).local_def_index) ), hir::ItemKind::Enum(..) => record!(self.tables.children[def_id] <- self.tcx.adt_def(def_id).variants.iter().map(|v| { @@ -1539,12 +1540,41 @@ impl EncodeContext<'a, 'tcx> { // so we manually encode just the information that we need for proc_macro in &hir.krate().proc_macros { let id = proc_macro.owner.local_def_index; - let span = self.lazy(hir.span(*proc_macro)); + let mut name = hir.name(*proc_macro); + let span = hir.span(*proc_macro); // Proc-macros may have attributes like `#[allow_internal_unstable]`, // so downstream crates need access to them. - let attrs = self.lazy(hir.attrs(*proc_macro)); - self.tables.span.set(id, span); - self.tables.attributes.set(id, attrs); + let attrs = hir.attrs(*proc_macro); + let macro_kind = if tcx.sess.contains_name(attrs, sym::proc_macro) { + MacroKind::Bang + } else if tcx.sess.contains_name(attrs, sym::proc_macro_attribute) { + MacroKind::Attr + } else if let Some(attr) = tcx.sess.find_by_name(attrs, sym::proc_macro_derive) { + // This unwrap chain should have been checked by the proc-macro harness. + name = attr.meta_item_list().unwrap()[0] + .meta_item() + .unwrap() + .ident() + .unwrap() + .name; + MacroKind::Derive + } else { + bug!("Unknown proc-macro type for item {:?}", id); + }; + + let mut def_key = self.tcx.hir().def_key(proc_macro.owner); + def_key.disambiguated_data.data = DefPathData::MacroNs(name); + + let def_id = DefId::local(id); + record!(self.tables.kind[def_id] <- EntryKind::ProcMacro(macro_kind)); + record!(self.tables.attributes[def_id] <- attrs); + record!(self.tables.def_keys[def_id] <- def_key); + record!(self.tables.ident_span[def_id] <- span); + record!(self.tables.span[def_id] <- span); + record!(self.tables.visibility[def_id] <- ty::Visibility::Public); + if let Some(stability) = stability { + record!(self.tables.stability[def_id] <- stability); + } } Some(ProcMacroData { proc_macro_decls_static, stability, macros }) @@ -1836,7 +1866,7 @@ impl EncodeContext<'a, 'tcx> { | hir::ItemKind::Const(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Mod(..) - | hir::ItemKind::ForeignMod(..) + | hir::ItemKind::ForeignMod { .. } | hir::ItemKind::GlobalAsm(..) | hir::ItemKind::ExternCrate(..) | hir::ItemKind::Use(..) @@ -1913,6 +1943,8 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> { fn visit_impl_item(&mut self, _impl_item: &'v hir::ImplItem<'v>) { // handled in `visit_item` above } + + fn visit_foreign_item(&mut self, _foreign_item: &'v hir::ForeignItem<'v>) {} } /// Used to prefetch queries which will be needed later by metadata encoding. @@ -1977,6 +2009,11 @@ impl<'tcx, 'v> ParItemLikeVisitor<'v> for PrefetchVisitor<'tcx> { hir::ImplItemKind::TyAlias(..) => (), } } + + fn visit_foreign_item(&self, _foreign_item: &'v hir::ForeignItem<'v>) { + // This should be kept in sync with `encode_info_for_foreign_item`. + // Foreign items contain no MIR. + } } // NOTE(eddyb) The following comment was preserved for posterity, even diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index 2bd2019d3cd..53606178909 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -20,6 +20,7 @@ use rustc_serialize::opaque::Encoder; use rustc_session::config::SymbolManglingVersion; use rustc_session::CrateDisambiguator; use rustc_span::edition::Edition; +use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{Ident, Symbol}; use rustc_span::{self, ExpnData, ExpnId, Span}; use rustc_target::spec::{PanicStrategy, TargetTriple}; @@ -336,6 +337,7 @@ enum EntryKind { ForeignFn(Lazy<FnData>), Mod(Lazy<ModData>), MacroDef(Lazy<MacroDef>), + ProcMacro(MacroKind), Closure, Generator(hir::GeneratorKind), Trait(Lazy<TraitData>), |
