Skip to content

Commit a9f0f6d

Browse files
add "Implementations on Foreign Types" to the sidebar
1 parent b357a9c commit a9f0f6d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/librustdoc/html/render.rs

+11
Original file line numberDiff line numberDiff line change
@@ -3535,6 +3535,17 @@ fn sidebar_trait(fmt: &mut fmt::Formatter, it: &clean::Item,
35353535

35363536
sidebar.push_str(&sidebar_assoc_items(it));
35373537

3538+
let c = cache();
3539+
3540+
if let Some(implementors) = c.implementors.get(&it.def_id) {
3541+
if implementors.iter().any(|i| i.impl_.for_.def_id()
3542+
.map_or(false, |d| !c.paths.contains_key(&d)))
3543+
{
3544+
sidebar.push_str("<li><a href=\"#foreign-impls\">\
3545+
Implementations on Foreign Types</a></li>");
3546+
}
3547+
}
3548+
35383549
sidebar.push_str("<li><a href=\"#implementors\">Implementors</a></li>");
35393550

35403551
write!(fmt, "<div class=\"block items\"><ul>{}</ul></div>", sidebar)

0 commit comments

Comments
 (0)