Skip to content

Commit 1a48d1a

Browse files
Add documentation and FIXME
1 parent b336f28 commit 1a48d1a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/librustdoc/html/render/span_map.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,20 @@ struct SpanMapVisitor<'tcx> {
9797
}
9898

9999
impl<'tcx> SpanMapVisitor<'tcx> {
100-
fn handle_path(&mut self, path: &rustc_hir::Path<'_>, path_span: Option<Span>) -> bool {
100+
/// This function is where we handle `hir::Path` elements and add them into the "span map".
101+
fn handle_path(&mut self, path: &rustc_hir::Path<'_>, path_span: Option<Span>) {
101102
let info = match path.res {
103+
// FIXME: For now, we only handle `DefKind` if it's not `DefKind::TyParam` or
104+
// `DefKind::Macro`. Would be nice to support them too alongside the other `DefKind`
105+
// (such as primitive types!).
102106
Res::Def(kind, def_id) if kind != DefKind::TyParam => {
103107
if matches!(kind, DefKind::Macro(_)) {
104-
return false;
108+
return;
105109
}
106110
Some(def_id)
107111
}
108112
Res::Local(_) => None,
109-
_ => return true,
113+
_ => return,
110114
};
111115
if let Some(span) = self.tcx.hir().res_span(path.res) {
112116
self.matches.insert(
@@ -123,7 +127,6 @@ impl<'tcx> SpanMapVisitor<'tcx> {
123127
LinkFromSrc::External(def_id),
124128
);
125129
}
126-
true
127130
}
128131
}
129132

0 commit comments

Comments
 (0)