Don't render [src] link on dummy spans

This commit is contained in:
Guillaume Gomez 2021-02-20 15:05:50 +01:00
parent e7c23ab933
commit 3071685505
2 changed files with 7 additions and 0 deletions

View File

@ -1852,6 +1852,10 @@ impl Span {
self.0
}
crate fn is_dummy(&self) -> bool {
self.0.is_dummy()
}
crate fn filename(&self, sess: &Session) -> FileName {
sess.source_map().span_to_filename(self.0)
}

View File

@ -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());