rustdoc: remove std:: from primitive intra-doc link tooltips

This commit is contained in:
Michael Howell 2023-03-15 11:34:37 -07:00
parent e4b9f86054
commit 683c12cb91
2 changed files with 8 additions and 0 deletions

View file

@ -771,6 +771,12 @@ pub(crate) fn link_tooltip(did: DefId, fragment: &Option<UrlFragment>, cx: &Cont
.or_else(|| cache.external_paths.get(&did))
else { return String::new() };
let mut buf = Buffer::new();
let fqp = if *shortty == ItemType::Primitive {
// primitives are documented in a crate, but not actually part of it
&fqp[fqp.len() - 1..]
} else {
&fqp
};
if let &Some(UrlFragment::Item(id)) = fragment {
write!(buf, "{} ", cx.tcx().def_descr(id));
for component in fqp {