1
Fork 0

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:
zetanumbers 2023-12-01 05:28:34 -08:00
parent 27d8a57713
commit 24f009c5e5
122 changed files with 390 additions and 393 deletions

View file

@ -122,7 +122,7 @@ fn diagnostic_hir_wf_check<'tcx>(
// We will walk 'into' this type to try to find
// a more precise span for our predicate.
let tys = match loc {
WellFormedLoc::Ty(_) => match hir.get(hir_id) {
WellFormedLoc::Ty(_) => match tcx.hir_node(hir_id) {
hir::Node::ImplItem(item) => match item.kind {
hir::ImplItemKind::Type(ty) => vec![ty],
hir::ImplItemKind::Const(ty, _) => vec![ty],