Skip to content

Commit

Permalink
rustdoc: render visibility on associated types
Browse files Browse the repository at this point in the history
This should only affect inherent associated types.
  • Loading branch information
wackbyte committed Apr 28, 2023
1 parent 1a6ae3d commit db5d3f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc/anchors.no_type_anchor2.html
Original file line number Diff line number Diff line change
@@ -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>
<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 comments on commit db5d3f0

Please sign in to comment.