Skip to content

Commit 0e9be63

Browse files
committed
Make extern_mod_stmt_cnum into a regular function
cc #83126 It's very short, so there's no need for it to go through the query system.
1 parent bb4cdf8 commit 0e9be63

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

compiler/rustc_middle/src/query/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1277,10 +1277,6 @@ rustc_queries! {
12771277
query item_children(def_id: DefId) -> &'tcx [Export<hir::HirId>] {
12781278
desc { |tcx| "collecting child items of `{}`", tcx.def_path_str(def_id) }
12791279
}
1280-
query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
1281-
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
1282-
}
1283-
12841280
query get_lib_features(_: CrateNum) -> LibFeatures {
12851281
storage(ArenaCacheSelector<'tcx>)
12861282
eval_always

compiler/rustc_middle/src/ty/context.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,12 @@ impl<'tcx> TyCtxt<'tcx> {
15501550
def_kind => (def_kind.article(), def_kind.descr(def_id)),
15511551
}
15521552
}
1553+
1554+
/// Returns the `CrateNum` of the crate that the given `extern crate` statement
1555+
/// resolves to.
1556+
pub fn extern_mod_stmt_cnum(self, id: LocalDefId) -> Option<CrateNum> {
1557+
self.extern_crate_map.get(&id).cloned()
1558+
}
15531559
}
15541560

15551561
/// A trait implemented for all `X<'a>` types that can be safely and
@@ -2755,7 +2761,6 @@ pub fn provide(providers: &mut ty::query::Providers) {
27552761
let id = tcx.hir().local_def_id_to_hir_id(id.expect_local());
27562762
tcx.stability().local_deprecation_entry(id)
27572763
};
2758-
providers.extern_mod_stmt_cnum = |tcx, id| tcx.extern_crate_map.get(&id).cloned();
27592764
providers.all_crate_nums = |tcx, cnum| {
27602765
assert_eq!(cnum, LOCAL_CRATE);
27612766
tcx.arena.alloc_slice(&tcx.cstore.crates_untracked())

0 commit comments

Comments
 (0)