Move some Map methods onto TyCtxt.

The end goal is to eliminate `Map` altogether.

I added a `hir_` prefix to all of them, that seemed simplest. The
exceptions are `module_items` which became `hir_module_free_items` because
there was already a `hir_module_items`, and `items` which became
`hir_free_items` for consistency with `hir_module_free_items`.
This commit is contained in:
Nicholas Nethercote 2025-02-03 10:45:49 +11:00
parent cd1d84cdf7
commit f86f7ad5f2
197 changed files with 465 additions and 476 deletions

View file

@ -3299,13 +3299,12 @@ define_print_and_forward_display! {
fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, Namespace, DefId)) {
// Iterate all local crate items no matter where they are defined.
let hir = tcx.hir();
for id in hir.items() {
for id in tcx.hir_free_items() {
if matches!(tcx.def_kind(id.owner_id), DefKind::Use) {
continue;
}
let item = hir.item(id);
let item = tcx.hir_item(id);
if item.ident.name == kw::Empty {
continue;
}