diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-07-24 15:08:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-24 15:08:19 +0200 |
| commit | 404f904f76531a43246c74e291e199a14b456f68 (patch) | |
| tree | 1e9eea3f5d0247ac96cb46265daee0d5cc15fd28 /compiler/rustc_middle/src | |
| parent | fc5af1813307d25a84d633f21e2e53c9376eb547 (diff) | |
| parent | 3440bc92f90366a9f65ec2b86e3e1b5fe3922aa6 (diff) | |
| download | rust-404f904f76531a43246c74e291e199a14b456f68.tar.gz rust-404f904f76531a43246c74e291e199a14b456f68.zip | |
Rollup merge of #143374 - cjgillot:bare-extern-crate-map, r=petrochenkov
Unquerify extern_mod_stmt_cnum. Based on https://github.com/rust-lang/rust/pull/143247 r? `````@ghost````` for perf
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 638dc2c78e4..b0d579a546f 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2152,9 +2152,6 @@ rustc_queries! { desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) } separate_provide_extern } - query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> { - desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) } - } /// Gets the number of definitions in a foreign crate. /// diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index aa2494a4f61..9d9cc3403dc 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -3377,6 +3377,11 @@ impl<'tcx> TyCtxt<'tcx> { self.resolutions(()).module_children.get(&def_id).map_or(&[], |v| &v[..]) } + /// Return the crate imported by given use item. + pub fn extern_mod_stmt_cnum(self, def_id: LocalDefId) -> Option<CrateNum> { + self.resolutions(()).extern_crate_map.get(&def_id).copied() + } + pub fn resolver_for_lowering(self) -> &'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)> { self.resolver_for_lowering_raw(()).0 } @@ -3432,8 +3437,6 @@ pub struct DeducedParamAttrs { } pub fn provide(providers: &mut Providers) { - providers.extern_mod_stmt_cnum = - |tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned(); providers.is_panic_runtime = |tcx, LocalCrate| contains_name(tcx.hir_krate_attrs(), sym::panic_runtime); providers.is_compiler_builtins = |
