Skip to content

Commit cc09326

Browse files
Fix inconsistency on visibility display for typedefs
1 parent e948e8d commit cc09326

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/librustdoc/html/render/print_item.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer,
133133
clean::StructItem(ref s) => item_struct(buf, cx, item, s),
134134
clean::UnionItem(ref s) => item_union(buf, cx, item, s),
135135
clean::EnumItem(ref e) => item_enum(buf, cx, item, e),
136-
clean::TypedefItem(ref t, _) => item_typedef(buf, cx, item, t),
136+
clean::TypedefItem(ref t, is_associated) => item_typedef(buf, cx, item, t, is_associated),
137137
clean::MacroItem(ref m) => item_macro(buf, cx, item, m),
138138
clean::ProcMacroItem(ref m) => item_proc_macro(buf, cx, item, m),
139139
clean::PrimitiveItem(_) => item_primitive(buf, cx, item),
@@ -837,9 +837,18 @@ fn item_opaque_ty(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean:
837837
render_assoc_items(w, cx, it, it.def_id.expect_def_id(), AssocItemRender::All)
838838
}
839839

840-
fn item_typedef(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Typedef) {
840+
fn item_typedef(
841+
w: &mut Buffer,
842+
cx: &Context<'_>,
843+
it: &clean::Item,
844+
t: &clean::Typedef,
845+
is_associated: bool,
846+
) {
841847
w.write_str("<pre class=\"rust typedef\">");
842848
render_attributes_in_pre(w, it, "");
849+
if !is_associated {
850+
write!(w, "{}", it.visibility.print_with_space(it.def_id, cx));
851+
}
843852
write!(
844853
w,
845854
"type {}{}{where_clause} = {type_};</pre>",

0 commit comments

Comments
 (0)