Encode proc macro stability

This commit is contained in:
John Kåre Alsaker 2019-01-28 23:40:14 +01:00
parent e501a87e89
commit 70156fbb75
3 changed files with 7 additions and 2 deletions

View File

@ -648,7 +648,7 @@ impl<'a, 'tcx> CrateMetadata {
pub fn get_stability(&self, id: DefIndex) -> Option<attr::Stability> {
match self.is_proc_macro(id) {
true => None,
true => self.root.proc_macro_stability.clone(),
false => self.entry(id).stability.map(|stab| stab.decode(self)),
}
}

View File

@ -490,7 +490,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
} else {
None
},
proc_macro_stability: if is_proc_macro {
tcx.lookup_stability(DefId::local(CRATE_DEF_INDEX)).map(|stab| stab.clone())
} else {
None
},
compiler_builtins: attr::contains_name(&attrs, "compiler_builtins"),
needs_allocator: attr::contains_name(&attrs, "needs_allocator"),
needs_panic_runtime: attr::contains_name(&attrs, "needs_panic_runtime"),

View File

@ -187,6 +187,7 @@ pub struct CrateRoot {
pub has_default_lib_allocator: bool,
pub plugin_registrar_fn: Option<DefIndex>,
pub proc_macro_decls_static: Option<DefIndex>,
pub proc_macro_stability: Option<attr::Stability>,
pub crate_deps: LazySeq<CrateDep>,
pub dylib_dependency_formats: LazySeq<Option<LinkagePreference>>,