about summary refs log tree commit diff
diff options
context:
space:
mode:
authorwackbyte <wackbyte@pm.me>2023-04-27 23:03:08 -0400
committerwackbyte <wackbyte@pm.me>2023-04-28 08:24:30 -0400
commitdb5d3f04c6796f7081550de590e860a6350eefda (patch)
treeb5aa4d4e8b84e25b1433973a475cae0259f85b9f
parent1a6ae3d692cfb52b21d0f45ba50b659486e53d6c (diff)
downloadrust-db5d3f04c6796f7081550de590e860a6350eefda.tar.gz
rust-db5d3f04c6796f7081550de590e860a6350eefda.zip
rustdoc: render visibility on associated types
This should only affect inherent associated types.
-rw-r--r--src/librustdoc/html/render/mod.rs4
-rw-r--r--tests/rustdoc/anchors.no_type_anchor2.html2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index a5f08fdac11..9bac1b93f0d 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -787,10 +787,12 @@ fn assoc_type(
     indent: usize,
     cx: &Context<'_>,
 ) {
+    let tcx = cx.tcx();
     write!(
         w,
-        "{indent}type <a{href} class=\"associatedtype\">{name}</a>{generics}",
+        "{indent}{vis}type <a{href} class=\"associatedtype\">{name}</a>{generics}",
         indent = " ".repeat(indent),
+        vis = visibility_print_with_space(it.visibility(tcx), it.item_id, cx),
         href = assoc_href_attr(it, link, cx),
         name = it.name.as_ref().unwrap(),
         generics = generics.print(cx),
diff --git a/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html
index f8b59160f15..9b70da68e78 100644
--- a/tests/rustdoc/anchors.no_type_anchor2.html
+++ b/tests/rustdoc/anchors.no_type_anchor2.html
@@ -1 +1 @@
-<section id="associatedtype.Y" class="associatedtype"><h4 class="code-header">type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section>
\ No newline at end of file
+<section id="associatedtype.Y" class="associatedtype"><h4 class="code-header">pub type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></h4></section>
\ No newline at end of file