From: Guillaume Gomez Date: Mon, 2 May 2022 13:06:45 +0000 (+0200) Subject: Fix regression in link-to-definition introduced in #93803 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a26cb6154d3f357fccc15fea5e47ed6a82c9a8f3;p=rust.git Fix regression in link-to-definition introduced in #93803 --- diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index b5502309560..02a52b2f98b 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -5,7 +5,7 @@ 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; @@ -100,7 +100,17 @@ fn nested_visit_map(&mut self) -> Self::Map { 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);