about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-02-20 20:37:04 +0100
committerGitHub <noreply@github.com>2021-02-20 20:37:04 +0100
commitfc0cb5d5eb58135cde86f28895e8c282bb2e77d3 (patch)
treed9ffe6f6cc3d3aa18d273ba97df396afe93e98a8 /src/librustdoc/html
parent77b6f96054b34ce5b608cf0b4ba479fd3837d5dd (diff)
parent0c511c9115cc4f8eff7ad50878af032427076c4c (diff)
downloadrust-fc0cb5d5eb58135cde86f28895e8c282bb2e77d3.tar.gz
rust-fc0cb5d5eb58135cde86f28895e8c282bb2e77d3.zip
Rollup merge of #82332 - GuillaumeGomez:no-src-link-on-dummy-spans, r=jyn514
Don't generate src link on dummy spans

Just realized that the "auto trait impls" had `[src]` links were leading to the crate root because they were dummy spans. This PR fixes this issue.

cc `@jyn514`
r? `@camelid`
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index f5eb92c1bb5..7ca355ed11c 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1638,6 +1638,9 @@ impl Context<'_> {
     /// may happen, for example, with externally inlined items where the source
     /// of their crate documentation isn't known.
     fn src_href(&self, item: &clean::Item) -> Option<String> {
+        if item.source.is_dummy() {
+            return None;
+        }
         let mut root = self.root_path();
         let mut path = String::new();
         let cnum = item.source.cnum(self.sess());