From a9f0f6df94c4d08fe300b6e06941aea9c7324530 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Tue, 15 Aug 2017 16:05:03 -0500 Subject: [PATCH] add "Implementations on Foreign Types" to the sidebar --- src/librustdoc/html/render.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 1836476f23b..46bb119cf9c 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -3535,6 +3535,17 @@ fn sidebar_trait(fmt: &mut fmt::Formatter, it: &clean::Item, sidebar.push_str(&sidebar_assoc_items(it)); + let c = cache(); + + if let Some(implementors) = c.implementors.get(&it.def_id) { + if implementors.iter().any(|i| i.impl_.for_.def_id() + .map_or(false, |d| !c.paths.contains_key(&d))) + { + sidebar.push_str("
  • \ + Implementations on Foreign Types
  • "); + } + } + sidebar.push_str("
  • Implementors
  • "); write!(fmt, "
    ", sidebar)