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 fc532c5b32
commit 8cf9eea5b3
102 changed files with 146 additions and 150 deletions

View file

@ -326,9 +326,9 @@ impl UnconditionalRecursion {
.find(|item| {
item.kind == AssocKind::Fn && item.def_id.is_local() && item.name == kw::Default
})
&& let Some(body_node) = cx.tcx.hir().get_if_local(assoc_item.def_id)
&& let Some(body_node) = cx.tcx.hir_get_if_local(assoc_item.def_id)
&& let Some(body_id) = body_node.body_id()
&& let body = cx.tcx.hir().body(body_id)
&& let body = cx.tcx.hir_body(body_id)
// We don't want to keep it if it has conditional return.
&& let [return_expr] = get_return_calls_in_body(body).as_slice()
&& let ExprKind::Call(call_expr, _) = return_expr.kind