Skip to content

Commit ad2b0f8

Browse files
committed
Unquerify extern_mod_stmt_cnum.
1 parent 8f08b3a commit ad2b0f8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,9 +2152,6 @@ rustc_queries! {
21522152
desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
21532153
separate_provide_extern
21542154
}
2155-
query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
2156-
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) }
2157-
}
21582155

21592156
/// Gets the number of definitions in a foreign crate.
21602157
///

compiler/rustc_middle/src/ty/context.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3373,6 +3373,11 @@ impl<'tcx> TyCtxt<'tcx> {
33733373
self.resolutions(()).module_children.get(&def_id).map_or(&[], |v| &v[..])
33743374
}
33753375

3376+
/// Return the crate imported by given use item.
3377+
pub fn extern_mod_stmt_cnum(self, def_id: LocalDefId) -> Option<CrateNum> {
3378+
self.resolutions(()).extern_crate_map.get(&def_id).copied()
3379+
}
3380+
33763381
pub fn resolver_for_lowering(self) -> &'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)> {
33773382
self.resolver_for_lowering_raw(()).0
33783383
}
@@ -3430,8 +3435,6 @@ pub struct DeducedParamAttrs {
34303435
pub fn provide(providers: &mut Providers) {
34313436
providers.maybe_unused_trait_imports =
34323437
|tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
3433-
providers.extern_mod_stmt_cnum =
3434-
|tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
34353438
providers.is_panic_runtime =
34363439
|tcx, LocalCrate| contains_name(tcx.hir_krate_attrs(), sym::panic_runtime);
34373440
providers.is_compiler_builtins =

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
12551255
return;
12561256
}
12571257

1258-
if self.tcx.extern_mod_stmt_cnum(hir_id.owner).is_none() {
1258+
if self.tcx.extern_mod_stmt_cnum(hir_id.owner.def_id).is_none() {
12591259
self.tcx.emit_node_span_lint(
12601260
INVALID_DOC_ATTRIBUTES,
12611261
hir_id,

0 commit comments

Comments
 (0)