Skip to content

Commit 3b98571

Browse files
Prevent duplicated impl on foreign types
1 parent 8785e34 commit 3b98571

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/librustdoc/html/render.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -2943,12 +2943,16 @@ fn item_trait(
29432943
</h2>
29442944
")?;
29452945

2946+
let mut foreign_cache = FxHashSet();
29462947
for implementor in foreign {
2947-
let assoc_link = AssocItemLink::GotoSource(
2948-
implementor.impl_item.def_id, &implementor.inner_impl().provided_trait_methods
2949-
);
2950-
render_impl(w, cx, &implementor, assoc_link,
2951-
RenderMode::Normal, implementor.impl_item.stable_since(), false)?;
2948+
if foreign_cache.insert(implementor.inner_impl().to_string()) {
2949+
let assoc_link = AssocItemLink::GotoSource(
2950+
implementor.impl_item.def_id,
2951+
&implementor.inner_impl().provided_trait_methods
2952+
);
2953+
render_impl(w, cx, &implementor, assoc_link,
2954+
RenderMode::Normal, implementor.impl_item.stable_since(), false)?;
2955+
}
29522956
}
29532957
}
29542958

0 commit comments

Comments
 (0)