about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-20 10:42:18 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-08-05 23:08:29 +0200
commit1a48d1a4de1e26e08780a026daed3c7db743ff2f (patch)
tree83b0f6024f96e0541d7738153c6daf9375c37266 /src
parentb336f2801c1d458990b7122bc4eba126beea37f9 (diff)
downloadrust-1a48d1a4de1e26e08780a026daed3c7db743ff2f.tar.gz
rust-1a48d1a4de1e26e08780a026daed3c7db743ff2f.zip
Add documentation and FIXME
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/span_map.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs
index daeb43b77db..e168e41b832 100644
--- a/src/librustdoc/html/render/span_map.rs
+++ b/src/librustdoc/html/render/span_map.rs
@@ -97,16 +97,20 @@ struct SpanMapVisitor<'tcx> {
 }
 
 impl<'tcx> SpanMapVisitor<'tcx> {
-    fn handle_path(&mut self, path: &rustc_hir::Path<'_>, path_span: Option<Span>) -> bool {
+    /// This function is where we handle `hir::Path` elements and add them into the "span map".
+    fn handle_path(&mut self, path: &rustc_hir::Path<'_>, path_span: Option<Span>) {
         let info = match path.res {
+            // FIXME: For now, we only handle `DefKind` if it's not `DefKind::TyParam` or
+            // `DefKind::Macro`. Would be nice to support them too alongside the other `DefKind`
+            // (such as primitive types!).
             Res::Def(kind, def_id) if kind != DefKind::TyParam => {
                 if matches!(kind, DefKind::Macro(_)) {
-                    return false;
+                    return;
                 }
                 Some(def_id)
             }
             Res::Local(_) => None,
-            _ => return true,
+            _ => return,
         };
         if let Some(span) = self.tcx.hir().res_span(path.res) {
             self.matches.insert(
@@ -123,7 +127,6 @@ impl<'tcx> SpanMapVisitor<'tcx> {
                 LinkFromSrc::External(def_id),
             );
         }
-        true
     }
 }