Unquerify extern_mod_stmt_cnum.

This commit is contained in:
Camille GILLOT 2025-07-03 13:30:59 +00:00
parent a7a1618e6c
commit 3440bc92f9
3 changed files with 6 additions and 6 deletions

View file

@ -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.
///

View file

@ -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 =

View file

@ -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,