about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/reachable.rs
diff options
context:
space:
mode:
authorzetanumbers <dariasukhonina@gmail.com>2023-12-01 05:28:34 -0800
committerzetanumbers <dariasukhonina@gmail.com>2023-12-12 06:40:29 -0800
commit24f009c5e55d18c12563dd74681ca33b8a349936 (patch)
tree0213624c5633448b305008c7b5683799cdde4996 /compiler/rustc_passes/src/reachable.rs
parent27d8a577138c0d319a572cd1a464c2b755e577de (diff)
downloadrust-24f009c5e55d18c12563dd74681ca33b8a349936.tar.gz
rust-24f009c5e55d18c12563dd74681ca33b8a349936.zip
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`
Diffstat (limited to 'compiler/rustc_passes/src/reachable.rs')
-rw-r--r--compiler/rustc_passes/src/reachable.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs
index f89c1b0e47c..f46f831ddd7 100644
--- a/compiler/rustc_passes/src/reachable.rs
+++ b/compiler/rustc_passes/src/reachable.rs
@@ -115,7 +115,7 @@ impl<'tcx> ReachableContext<'tcx> {
             return false;
         };
 
-        match self.tcx.hir().find_by_def_id(def_id) {
+        match self.tcx.opt_hir_node_by_def_id(def_id) {
             Some(Node::Item(item)) => match item.kind {
                 hir::ItemKind::Fn(..) => item_might_be_inlined(self.tcx, def_id.into()),
                 _ => false,
@@ -146,7 +146,7 @@ impl<'tcx> ReachableContext<'tcx> {
                 continue;
             }
 
-            if let Some(ref item) = self.tcx.hir().find_by_def_id(search_item) {
+            if let Some(ref item) = self.tcx.opt_hir_node_by_def_id(search_item) {
                 self.propagate_node(item, search_item);
             }
         }