Skip to content

Commit 43e4bbd

Browse files
committed
rustdoc: add 🔒 to indicate restricted visibility
1 parent 8d60bf4 commit 43e4bbd

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/librustdoc/html/render/print_item.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,24 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
376376
let stab = myitem.stability_class(cx.tcx());
377377
let add = if stab.is_some() { " " } else { "" };
378378

379+
let visibility_emoji = match myitem.visibility {
380+
clean::Visibility::Restricted(_) => "<span title=\"Restricted Visibility\">🔒</span> ",
381+
_ => ""
382+
};
383+
379384
let doc_value = myitem.doc_value().unwrap_or_default();
380385
w.write_str(ITEM_TABLE_ROW_OPEN);
381386
write!(
382387
w,
383388
"<div class=\"item-left {stab}{add}module-item\">\
384-
<a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
385-
{unsafety_flag}\
386-
{stab_tags}\
389+
{visibility_emoji}\
390+
<a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
391+
{unsafety_flag}\
392+
{stab_tags}\
387393
</div>\
388394
<div class=\"item-right docblock-short\">{docs}</div>",
389395
name = myitem.name.unwrap(),
396+
visibility_emoji = visibility_emoji,
390397
stab_tags = extra_info_tags(myitem, item, cx.tcx()),
391398
docs = MarkdownSummaryLine(&doc_value, &myitem.links(cx)).into_string(),
392399
class = myitem.type_(),

0 commit comments

Comments
 (0)