Skip to content

Commit 70156fb

Browse files
committed
Encode proc macro stability
1 parent e501a87 commit 70156fb

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/librustc_metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ impl<'a, 'tcx> CrateMetadata {
648648

649649
pub fn get_stability(&self, id: DefIndex) -> Option<attr::Stability> {
650650
match self.is_proc_macro(id) {
651-
true => None,
651+
true => self.root.proc_macro_stability.clone(),
652652
false => self.entry(id).stability.map(|stab| stab.decode(self)),
653653
}
654654
}

src/librustc_metadata/encoder.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
490490
} else {
491491
None
492492
},
493-
493+
proc_macro_stability: if is_proc_macro {
494+
tcx.lookup_stability(DefId::local(CRATE_DEF_INDEX)).map(|stab| stab.clone())
495+
} else {
496+
None
497+
},
494498
compiler_builtins: attr::contains_name(&attrs, "compiler_builtins"),
495499
needs_allocator: attr::contains_name(&attrs, "needs_allocator"),
496500
needs_panic_runtime: attr::contains_name(&attrs, "needs_panic_runtime"),

src/librustc_metadata/schema.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ pub struct CrateRoot {
187187
pub has_default_lib_allocator: bool,
188188
pub plugin_registrar_fn: Option<DefIndex>,
189189
pub proc_macro_decls_static: Option<DefIndex>,
190+
pub proc_macro_stability: Option<attr::Stability>,
190191

191192
pub crate_deps: LazySeq<CrateDep>,
192193
pub dylib_dependency_formats: LazySeq<Option<LinkagePreference>>,

0 commit comments

Comments
 (0)