Skip to content

Commit 26f113e

Browse files
committed
rustc_metadata: Remove CrateMetadata::is_proc_macro_crate
1 parent 09c1c94 commit 26f113e

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/librustc_metadata/rmeta/decoder.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,6 @@ impl<'a, 'tcx> CrateMetadata {
607607
}
608608
}
609609

610-
fn is_proc_macro_crate(&self) -> bool {
611-
self.root.is_proc_macro_crate()
612-
}
613-
614610
fn is_proc_macro(&self, id: DefIndex) -> bool {
615611
self.root.proc_macro_data.and_then(|data| data.decode(self).find(|x| *x == id)).is_some()
616612
}
@@ -895,7 +891,7 @@ impl<'a, 'tcx> CrateMetadata {
895891

896892
/// Iterates over the language items in the given crate.
897893
fn get_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)] {
898-
if self.is_proc_macro_crate() {
894+
if self.root.is_proc_macro_crate() {
899895
// Proc macro crates do not export any lang-items to the target.
900896
&[]
901897
} else {
@@ -911,7 +907,7 @@ impl<'a, 'tcx> CrateMetadata {
911907
&self,
912908
tcx: TyCtxt<'tcx>,
913909
) -> &'tcx FxHashMap<Symbol, DefId> {
914-
tcx.arena.alloc(if self.is_proc_macro_crate() {
910+
tcx.arena.alloc(if self.root.is_proc_macro_crate() {
915911
// Proc macro crates do not export any diagnostic-items to the target.
916912
Default::default()
917913
} else {
@@ -1219,7 +1215,7 @@ impl<'a, 'tcx> CrateMetadata {
12191215
tcx: TyCtxt<'tcx>,
12201216
filter: Option<DefId>,
12211217
) -> &'tcx [DefId] {
1222-
if self.is_proc_macro_crate() {
1218+
if self.root.is_proc_macro_crate() {
12231219
// proc-macro crates export no trait impls.
12241220
return &[]
12251221
}
@@ -1263,7 +1259,7 @@ impl<'a, 'tcx> CrateMetadata {
12631259

12641260

12651261
fn get_native_libraries(&self, sess: &Session) -> Vec<NativeLibrary> {
1266-
if self.is_proc_macro_crate() {
1262+
if self.root.is_proc_macro_crate() {
12671263
// Proc macro crates do not have any *target* native libraries.
12681264
vec![]
12691265
} else {
@@ -1272,7 +1268,7 @@ impl<'a, 'tcx> CrateMetadata {
12721268
}
12731269

12741270
fn get_foreign_modules(&self, tcx: TyCtxt<'tcx>) -> &'tcx [ForeignModule] {
1275-
if self.is_proc_macro_crate() {
1271+
if self.root.is_proc_macro_crate() {
12761272
// Proc macro crates do not have any *target* foreign modules.
12771273
&[]
12781274
} else {
@@ -1295,7 +1291,7 @@ impl<'a, 'tcx> CrateMetadata {
12951291
}
12961292

12971293
fn get_missing_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [lang_items::LangItem] {
1298-
if self.is_proc_macro_crate() {
1294+
if self.root.is_proc_macro_crate() {
12991295
// Proc macro crates do not depend on any target weak lang-items.
13001296
&[]
13011297
} else {
@@ -1319,7 +1315,7 @@ impl<'a, 'tcx> CrateMetadata {
13191315
&self,
13201316
tcx: TyCtxt<'tcx>,
13211317
) -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> {
1322-
if self.is_proc_macro_crate() {
1318+
if self.root.is_proc_macro_crate() {
13231319
// If this crate is a custom derive crate, then we're not even going to
13241320
// link those in so we skip those crates.
13251321
vec![]

src/librustc_metadata/rmeta/decoder/cstore_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl cstore::CStore {
410410
let _prof_timer = sess.prof.generic_activity("metadata_load_macro");
411411

412412
let data = self.get_crate_data(id.krate);
413-
if data.is_proc_macro_crate() {
413+
if data.root.is_proc_macro_crate() {
414414
return LoadedMacro::ProcMacro(data.load_proc_macro(id.index, sess));
415415
}
416416

0 commit comments

Comments
 (0)