hir: Remove opt_local_def_id_to_hir_id and opt_hir_node_by_def_id

Also replace a few `hir_node()` calls with `hir_node_by_def_id()`
This commit is contained in:
Vadim Petrochenkov 2024-03-14 21:05:06 +03:00
parent 30f74ff0dc
commit 89b536dbc8
37 changed files with 135 additions and 199 deletions

View file

@ -127,7 +127,7 @@ fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) -> Option<(DefId,
{
// non-local main imports are handled below
if let Some(def_id) = def_id.as_local()
&& matches!(tcx.opt_hir_node_by_def_id(def_id), Some(Node::ForeignItem(_)))
&& matches!(tcx.hir_node_by_def_id(def_id), Node::ForeignItem(_))
{
tcx.dcx().emit_err(ExternMain { span: tcx.def_span(def_id) });
return None;