Skip to content

Commit a26cb61

Browse files
Fix regression in link-to-definition introduced in rust-lang#93803
1 parent 6b6c1ff commit a26cb61

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/librustdoc/html/render/span_map.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_data_structures::fx::FxHashMap;
55
use rustc_hir::def::{DefKind, Res};
66
use rustc_hir::def_id::DefId;
77
use rustc_hir::intravisit::{self, Visitor};
8-
use rustc_hir::{ExprKind, GenericParam, HirId, Mod, Node};
8+
use rustc_hir::{ExprKind, Generics, HirId, Mod, Node, WherePredicate};
99
use rustc_middle::hir::nested_filter;
1010
use rustc_middle::ty::TyCtxt;
1111
use rustc_span::Span;
@@ -100,7 +100,17 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> {
100100
self.tcx.hir()
101101
}
102102

103-
fn visit_generic_param(&mut self, _: &'tcx GenericParam<'tcx>) {}
103+
fn visit_generics(&mut self, g: &'tcx Generics<'tcx>) {
104+
for predicate in g.predicates {
105+
if let WherePredicate::BoundPredicate(w) = predicate {
106+
for bound in w.bounds {
107+
if let Some(trait_ref) = bound.trait_ref() {
108+
self.handle_path(trait_ref.path, None);
109+
}
110+
}
111+
}
112+
}
113+
}
104114

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

0 commit comments

Comments
 (0)