diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 8fb3b570f8a4b..741efd8becd4e 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2943,12 +2943,16 @@ fn item_trait(
")?;
+ let mut foreign_cache = FxHashSet();
for implementor in foreign {
- let assoc_link = AssocItemLink::GotoSource(
- implementor.impl_item.def_id, &implementor.inner_impl().provided_trait_methods
- );
- render_impl(w, cx, &implementor, assoc_link,
- RenderMode::Normal, implementor.impl_item.stable_since(), false)?;
+ if foreign_cache.insert(implementor.inner_impl().to_string()) {
+ let assoc_link = AssocItemLink::GotoSource(
+ implementor.impl_item.def_id,
+ &implementor.inner_impl().provided_trait_methods
+ );
+ render_impl(w, cx, &implementor, assoc_link,
+ RenderMode::Normal, implementor.impl_item.stable_since(), false)?;
+ }
}
}