Rollup merge of #114772 - fee1-dead-contrib:typed-did, r=b-naber

Add `{Local}ModDefId` to more strongly type DefIds`

Based on #110862 by `@Nilstrieb`
This commit is contained in:
Guillaume Gomez 2023-08-15 14:29:45 +02:00 committed by GitHub
commit f0987ab45b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 324 additions and 100 deletions

View file

@ -67,7 +67,7 @@ use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, DocLinkResMap};
use rustc_hir::def_id::{
CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId, LocalDefIdMap, LocalDefIdSet,
CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
};
use rustc_hir::lang_items::{LangItem, LanguageItems};
use rustc_hir::{Crate, ItemLocalId, TraitCandidate};
@ -167,7 +167,7 @@ rustc_queries! {
///
/// This can be conveniently accessed by `tcx.hir().visit_item_likes_in_module`.
/// Avoid calling this query directly.
query hir_module_items(key: LocalDefId) -> &'tcx rustc_middle::hir::ModuleItems {
query hir_module_items(key: LocalModDefId) -> &'tcx rustc_middle::hir::ModuleItems {
arena_cache
desc { |tcx| "getting HIR module items in `{}`", tcx.def_path_str(key) }
cache_on_disk_if { true }
@ -896,7 +896,7 @@ rustc_queries! {
}
/// Performs lint checking for the module.
query lint_mod(key: LocalDefId) -> () {
query lint_mod(key: LocalModDefId) -> () {
desc { |tcx| "linting {}", describe_as_module(key, tcx) }
}
@ -905,35 +905,35 @@ rustc_queries! {
}
/// Checks the attributes in the module.
query check_mod_attrs(key: LocalDefId) -> () {
query check_mod_attrs(key: LocalModDefId) -> () {
desc { |tcx| "checking attributes in {}", describe_as_module(key, tcx) }
}
/// Checks for uses of unstable APIs in the module.
query check_mod_unstable_api_usage(key: LocalDefId) -> () {
query check_mod_unstable_api_usage(key: LocalModDefId) -> () {
desc { |tcx| "checking for unstable API usage in {}", describe_as_module(key, tcx) }
}
/// Checks the const bodies in the module for illegal operations (e.g. `if` or `loop`).
query check_mod_const_bodies(key: LocalDefId) -> () {
query check_mod_const_bodies(key: LocalModDefId) -> () {
desc { |tcx| "checking consts in {}", describe_as_module(key, tcx) }
}
/// Checks the loops in the module.
query check_mod_loops(key: LocalDefId) -> () {
query check_mod_loops(key: LocalModDefId) -> () {
desc { |tcx| "checking loops in {}", describe_as_module(key, tcx) }
}
query check_mod_naked_functions(key: LocalDefId) -> () {
query check_mod_naked_functions(key: LocalModDefId) -> () {
desc { |tcx| "checking naked functions in {}", describe_as_module(key, tcx) }
}
query check_mod_item_types(key: LocalDefId) -> () {
query check_mod_item_types(key: LocalModDefId) -> () {
desc { |tcx| "checking item types in {}", describe_as_module(key, tcx) }
}
query check_mod_privacy(key: LocalDefId) -> () {
desc { |tcx| "checking privacy in {}", describe_as_module(key, tcx) }
query check_mod_privacy(key: LocalModDefId) -> () {
desc { |tcx| "checking privacy in {}", describe_as_module(key.to_local_def_id(), tcx) }
}
query check_liveness(key: LocalDefId) {
@ -952,19 +952,19 @@ rustc_queries! {
desc { "finding live symbols in crate" }
}
query check_mod_deathness(key: LocalDefId) -> () {
query check_mod_deathness(key: LocalModDefId) -> () {
desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
}
query check_mod_impl_wf(key: LocalDefId) -> () {
query check_mod_impl_wf(key: LocalModDefId) -> () {
desc { |tcx| "checking that impls are well-formed in {}", describe_as_module(key, tcx) }
}
query check_mod_type_wf(key: LocalDefId) -> () {
query check_mod_type_wf(key: LocalModDefId) -> () {
desc { |tcx| "checking that types are well-formed in {}", describe_as_module(key, tcx) }
}
query collect_mod_item_types(key: LocalDefId) -> () {
query collect_mod_item_types(key: LocalModDefId) -> () {
desc { |tcx| "collecting item types in {}", describe_as_module(key, tcx) }
}