diff options
| author | bors <bors@rust-lang.org> | 2021-07-12 11:52:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-12 11:52:55 +0000 |
| commit | 3a24abd22fd25c836d8b4d75ff46c833f9c3934c (patch) | |
| tree | 90d044284d3cb40c99fc752e22f2bde1cfb810ee /src/librustdoc/html | |
| parent | e97c29bda238cf55ddd7eec772deb823364b1846 (diff) | |
| parent | 74d71c204f5d7243507d1fd430700516796b1cf8 (diff) | |
| download | rust-3a24abd22fd25c836d8b4d75ff46c833f9c3934c.tar.gz rust-3a24abd22fd25c836d8b4d75ff46c833f9c3934c.zip | |
Auto merge of #86841 - GuillaumeGomez:reexported-macro-2-render, r=Stupremee
Fix rendering of reexported macros 2.0 and fix visibility of reexported items So, this PR grew a bit out of focus, it does the following things: * Fixes #86276. * Fixes visibility display for reexported items: it now takes the visibility of the "use" statement rather than the visibility of the reexported item itself). * Fixes the display of reexported items if "--document-private-items" option is used. Before, they were simply skipped. * Fixes inconsistency on typedef items: they didn't display their visibility contrary to other items. I added tests to check everything listed above. cc `@camelid` `@ollie27` (in case one of you want to review?) r? `@jyn514`
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index eeac9d1a9db..f7073a8751f 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -133,7 +133,7 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, clean::StructItem(ref s) => item_struct(buf, cx, item, s), clean::UnionItem(ref s) => item_union(buf, cx, item, s), clean::EnumItem(ref e) => item_enum(buf, cx, item, e), - clean::TypedefItem(ref t, _) => item_typedef(buf, cx, item, t), + clean::TypedefItem(ref t, is_associated) => item_typedef(buf, cx, item, t, is_associated), clean::MacroItem(ref m) => item_macro(buf, cx, item, m), clean::ProcMacroItem(ref m) => item_proc_macro(buf, cx, item, m), 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: render_assoc_items(w, cx, it, it.def_id.expect_def_id(), AssocItemRender::All) } -fn item_typedef(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Typedef) { +fn item_typedef( + w: &mut Buffer, + cx: &Context<'_>, + it: &clean::Item, + t: &clean::Typedef, + is_associated: bool, +) { w.write_str("<pre class=\"rust typedef\">"); render_attributes_in_pre(w, it, ""); + if !is_associated { + write!(w, "{}", it.visibility.print_with_space(it.def_id, cx)); + } write!( w, "type {}{}{where_clause} = {type_};</pre>", |
