Move some methods from tcx.hir() to tcx
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
This commit is contained in:
@@ -154,8 +154,9 @@ pub fn recursive_type_error(
|
||||
let (_, field_id) = item_and_field_ids[i];
|
||||
let (next_item_id, _) = item_and_field_ids[(i + 1) % cycle_len];
|
||||
// Find the span(s) that contain the next item in the cycle
|
||||
let hir_id = tcx.local_def_id_to_hir_id(field_id);
|
||||
let hir::Node::Field(field) = tcx.hir().get(hir_id) else { bug!("expected field") };
|
||||
let hir::Node::Field(field) = tcx.hir_node_by_def_id(field_id) else {
|
||||
bug!("expected field")
|
||||
};
|
||||
let mut found = Vec::new();
|
||||
find_item_ty_spans(tcx, field.ty, next_item_id, &mut found, representable_ids);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user