diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2025-07-03 13:30:59 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2025-07-22 22:37:50 +0000 |
| commit | 3440bc92f90366a9f65ec2b86e3e1b5fe3922aa6 (patch) | |
| tree | 00cc432ffaea32228158e64d108a489e88dbcaeb | |
| parent | a7a1618e6c835f1f00940ad72203d05808209a0d (diff) | |
| download | rust-3440bc92f90366a9f65ec2b86e3e1b5fe3922aa6.tar.gz rust-3440bc92f90366a9f65ec2b86e3e1b5fe3922aa6.zip | |
Unquerify extern_mod_stmt_cnum.
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index ad7f4973e23..a80b323f4ae 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 51db92ecd78..aa1e753538c 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -3373,6 +3373,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 } @@ -3428,8 +3433,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 = diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 96c895e71df..22092521fd8 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1255,7 +1255,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return; } - if self.tcx.extern_mod_stmt_cnum(hir_id.owner).is_none() { + if self.tcx.extern_mod_stmt_cnum(hir_id.owner.def_id).is_none() { self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, |
