Skip to content

Commit b232992

Browse files
committed
Unquerify extern_mod_stmt_cnum.
1 parent 556d20a commit b232992

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,9 +2140,6 @@ rustc_queries! {
21402140
desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) }
21412141
separate_provide_extern
21422142
}
2143-
query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
2144-
desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) }
2145-
}
21462143

21472144
/// Gets the number of definitions in a foreign crate.
21482145
///

compiler/rustc_middle/src/ty/context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,6 +3360,11 @@ impl<'tcx> TyCtxt<'tcx> {
33603360
self.resolutions(()).module_children.get(&def_id).map_or(&[], |v| &v[..])
33613361
}
33623362

3363+
/// Return the crate imported by given use item.
3364+
pub fn extern_mod_stmt_cnum(self, def_id: LocalDefId) -> Option<CrateNum> {
3365+
self.resolutions(()).extern_crate_map.get(&def_id).copied()
3366+
}
3367+
33633368
pub fn resolver_for_lowering(self) -> &'tcx Steal<(ty::ResolverAstLowering, Arc<ast::Crate>)> {
33643369
self.resolver_for_lowering_raw(()).0
33653370
}
@@ -3416,9 +3421,6 @@ pub fn provide(providers: &mut Providers) {
34163421
providers.names_imported_by_glob_use = |tcx, id| {
34173422
tcx.arena.alloc(tcx.resolutions(()).glob_map.get(&id).cloned().unwrap_or_default())
34183423
};
3419-
3420-
providers.extern_mod_stmt_cnum =
3421-
|tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
34223424
providers.is_panic_runtime =
34233425
|tcx, LocalCrate| contains_name(tcx.hir_krate_attrs(), sym::panic_runtime);
34243426
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
@@ -1193,7 +1193,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
11931193
return;
11941194
}
11951195

1196-
if self.tcx.extern_mod_stmt_cnum(hir_id.owner).is_none() {
1196+
if self.tcx.extern_mod_stmt_cnum(hir_id.owner.def_id).is_none() {
11971197
self.tcx.emit_node_span_lint(
11981198
INVALID_DOC_ATTRIBUTES,
11991199
hir_id,

0 commit comments

Comments
 (0)