about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-13 10:31:56 +0000
committerbors <bors@rust-lang.org>2023-12-13 10:31:56 +0000
commit56d25ba5ea3515ba2b361b6c4636373734eb27cc (patch)
tree1de806c5bf33c3784188671089d3e84bf73ab4b5 /src/librustdoc/html/render
parent2fdd9eda0ce4fa0ecbf3099783f4f505235ceb44 (diff)
parent24f009c5e55d18c12563dd74681ca33b8a349936 (diff)
downloadrust-56d25ba5ea3515ba2b361b6c4636373734eb27cc.tar.gz
rust-56d25ba5ea3515ba2b361b6c4636373734eb27cc.zip
Auto merge of #118500 - ZetaNumbers:tcx_hir_refactor, r=petrochenkov
Move some methods from `tcx.hir()` to `tcx`

https://github.com/rust-lang/rust/pull/118256#issuecomment-1826442834

Renamed:
- 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
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/span_map.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs
index 5f130f1875a..d1ece73374d 100644
--- a/src/librustdoc/html/render/span_map.rs
+++ b/src/librustdoc/html/render/span_map.rs
@@ -94,7 +94,7 @@ impl<'tcx> SpanMapVisitor<'tcx> {
 
     /// Used to generate links on items' definition to go to their documentation page.
     pub(crate) fn extract_info_from_hir_id(&mut self, hir_id: HirId) {
-        if let Some(Node::Item(item)) = self.tcx.hir().find(hir_id) {
+        if let Some(Node::Item(item)) = self.tcx.opt_hir_node(hir_id) {
             if let Some(span) = self.tcx.def_ident_span(item.owner_id) {
                 let cspan = clean::Span::new(span);
                 // If the span isn't from the current crate, we ignore it.
@@ -177,7 +177,7 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> {
         if !span.overlaps(m.spans.inner_span) {
             // Now that we confirmed it's a file import, we want to get the span for the module
             // name only and not all the "mod foo;".
-            if let Some(Node::Item(item)) = self.tcx.hir().find(id) {
+            if let Some(Node::Item(item)) = self.tcx.opt_hir_node(id) {
                 self.matches.insert(
                     item.ident.span,
                     LinkFromSrc::Local(clean::Span::new(m.spans.inner_span)),