Skip to content

Commit d5b1b74

Browse files
committed
Record visibility of reexports for all items, not just type items
1 parent 8534be7 commit d5b1b74

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/librustdoc/visit_ast.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -303,26 +303,22 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
303303
if !res_did.is_local() && !is_no_inline {
304304
let attrs = clean::inline::load_attrs(self.cx, res_did);
305305
let self_is_hidden = attrs.lists(sym::doc).has_word(sym::hidden);
306-
match res {
307-
Res::Def(
308-
DefKind::Trait
309-
| DefKind::Struct
310-
| DefKind::Union
311-
| DefKind::Enum
312-
| DefKind::ForeignTy
313-
| DefKind::TyAlias,
314-
did,
315-
) if !self_is_hidden => {
316-
self.cx.renderinfo.get_mut().access_levels.map.insert(did, AccessLevel::Public);
317-
}
318-
Res::Def(DefKind::Mod, did) => {
319-
if !self_is_hidden {
320-
crate::visit_lib::LibEmbargoVisitor::new(self.cx).visit_mod(did);
306+
if !self_is_hidden {
307+
if let Res::Def(kind, did) = res {
308+
if kind == DefKind::Mod {
309+
crate::visit_lib::LibEmbargoVisitor::new(self.cx).visit_mod(did)
310+
} else {
311+
// All items need to be handled here in case someone wishes to link
312+
// to them with intra-doc links
313+
self.cx
314+
.renderinfo
315+
.get_mut()
316+
.access_levels
317+
.map
318+
.insert(did, AccessLevel::Public);
321319
}
322320
}
323-
_ => {}
324321
}
325-
326322
return false;
327323
}
328324

0 commit comments

Comments
 (0)