Skip to content

Commit

Permalink
Fix regression in link-to-definition introduced in rust-lang#93803
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 2, 2022
1 parent 6b6c1ff commit a26cb61
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/librustdoc/html/render/span_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::{ExprKind, GenericParam, HirId, Mod, Node};
use rustc_hir::{ExprKind, Generics, HirId, Mod, Node, WherePredicate};
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_span::Span;
Expand Down Expand Up @@ -100,7 +100,17 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> {
self.tcx.hir()
}

fn visit_generic_param(&mut self, _: &'tcx GenericParam<'tcx>) {}
fn visit_generics(&mut self, g: &'tcx Generics<'tcx>) {
for predicate in g.predicates {
if let WherePredicate::BoundPredicate(w) = predicate {
for bound in w.bounds {
if let Some(trait_ref) = bound.trait_ref() {
self.handle_path(trait_ref.path, None);
}
}
}
}
}

fn visit_path(&mut self, path: &'tcx rustc_hir::Path<'tcx>, _id: HirId) {
self.handle_path(path, None);
Expand Down

0 comments on commit a26cb61

Please sign in to comment.