diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 548f6c3a987..461b2f15494 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1415,7 +1415,10 @@ fn render_impl( id, item_type, in_trait_class, ); render_rightside(w, cx, item, containing_item, render_mode); - write!(w, "", id); + if trait_.is_some() { + // Anchors are only used on trait impls. + write!(w, "", id); + } w.write_str("