diff options
Diffstat (limited to 'src/librustdoc/scrape_examples.rs')
| -rw-r--r-- | src/librustdoc/scrape_examples.rs | 11 | 
1 files changed, 5 insertions, 6 deletions
| diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index 599671bd4d4..44551d75903 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -123,8 +123,8 @@ where { type NestedFilter = nested_filter::OnlyBodies; - fn nested_visit_map(&mut self) -> Self::Map { - self.cx.tcx().hir() + fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt { + self.cx.tcx() } fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) { @@ -135,8 +135,7 @@ where // If we visit an item that contains an expression outside a function body, // then we need to exit before calling typeck (which will panic). See // test/run-make/rustdoc-scrape-examples-invalid-expr for an example. - let hir = tcx.hir(); - if hir.maybe_body_owned_by(ex.hir_id.owner.def_id).is_none() { + if tcx.hir_maybe_body_owned_by(ex.hir_id.owner.def_id).is_none() { return; } @@ -178,7 +177,7 @@ where // If the enclosing item has a span coming from a proc macro, then we also don't want to // include the example. let enclosing_item_span = - tcx.hir().span_with_body(tcx.hir().get_parent_item(ex.hir_id).into()); + tcx.hir().span_with_body(tcx.hir_get_parent_item(ex.hir_id).into()); if enclosing_item_span.from_expansion() { trace!("Rejecting expr ({call_span:?}) from macro item: {enclosing_item_span:?}"); return; @@ -302,7 +301,7 @@ pub(crate) fn run( // Run call-finder on all items let mut calls = FxIndexMap::default(); let mut finder = FindCalls { calls: &mut calls, cx, target_crates, bin_crate }; - tcx.hir().visit_all_item_likes_in_crate(&mut finder); + tcx.hir_visit_all_item_likes_in_crate(&mut finder); // The visitor might have found a type error, which we need to // promote to a fatal error | 
