diff options
| author | wackbyte <wackbyte@pm.me> | 2023-04-27 23:03:08 -0400 |
|---|---|---|
| committer | wackbyte <wackbyte@pm.me> | 2023-04-28 08:24:30 -0400 |
| commit | db5d3f04c6796f7081550de590e860a6350eefda (patch) | |
| tree | b5aa4d4e8b84e25b1433973a475cae0259f85b9f | |
| parent | 1a6ae3d692cfb52b21d0f45ba50b659486e53d6c (diff) | |
| download | rust-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.rs | 4 | ||||
| -rw-r--r-- | tests/rustdoc/anchors.no_type_anchor2.html | 2 |
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 |
