Skip to content

Commit db5d3f0

Browse files
committed
rustdoc: render visibility on associated types
This should only affect inherent associated types.
1 parent 1a6ae3d commit db5d3f0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: src/librustdoc/html/render/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,12 @@ fn assoc_type(
787787
indent: usize,
788788
cx: &Context<'_>,
789789
) {
790+
let tcx = cx.tcx();
790791
write!(
791792
w,
792-
"{indent}type <a{href} class=\"associatedtype\">{name}</a>{generics}",
793+
"{indent}{vis}type <a{href} class=\"associatedtype\">{name}</a>{generics}",
793794
indent = " ".repeat(indent),
795+
vis = visibility_print_with_space(it.visibility(tcx), it.item_id, cx),
794796
href = assoc_href_attr(it, link, cx),
795797
name = it.name.as_ref().unwrap(),
796798
generics = generics.print(cx),

Diff for: tests/rustdoc/anchors.no_type_anchor2.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +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>
1+
<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>

0 commit comments

Comments
 (0)