diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index c1b2ee7d8ae..47f321a4c4a 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1730,6 +1730,7 @@ fn doc_impl_item(
let source_id = format!("{item_type}.{name}");
let id = cx.derive_id(&source_id);
write!(w, "");
+ render_rightside(w, cx, item, render_mode);
if trait_.is_some() {
// Anchors are only used on trait impls.
write!(w, "§");
@@ -1751,6 +1752,7 @@ fn doc_impl_item(
let source_id = format!("{item_type}.{name}");
let id = cx.derive_id(&source_id);
write!(w, "");
+ render_rightside(w, cx, item, render_mode);
if trait_.is_some() {
// Anchors are only used on trait impls.
write!(w, "§");
diff --git a/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html
index 71e93990e29..9127104ded4 100644
--- a/tests/rustdoc/anchors.no_type_anchor2.html
+++ b/tests/rustdoc/anchors.no_type_anchor2.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/rustdoc/assoc-type-source-link.rs b/tests/rustdoc/assoc-type-source-link.rs
new file mode 100644
index 00000000000..34b156b9649
--- /dev/null
+++ b/tests/rustdoc/assoc-type-source-link.rs
@@ -0,0 +1,26 @@
+// This test ensures that the source links are generated for impl associated types.
+
+#![crate_name = "foo"]
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+//@ has 'foo/struct.Bar.html'
+pub struct Bar;
+
+impl Bar {
+ //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a' 'source'
+ //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a/@href' \
+ // '../src/foo/assoc-type-source-link.rs.html#14'
+ pub type Y = u8;
+}
+
+pub trait Foo {
+ type Z;
+}
+
+impl Foo for Bar {
+ //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a' 'source'
+ //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a/@href' \
+ // '../src/foo/assoc-type-source-link.rs.html#25'
+ type Z = u8;
+}