Skip to content

Commit aab9c69

Browse files
committed
impl items are never unnamable
1 parent 662108d commit aab9c69

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/librustdoc/html/format.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,14 @@ fn is_unnamable(tcx: TyCtxt<'_>, did: DefId) -> bool {
497497
let mut cur_did = did;
498498
while let Some(parent) = tcx.opt_parent(cur_did) {
499499
match tcx.def_kind(parent) {
500-
// items defined in these can be linked to
501-
DefKind::Mod | DefKind::Impl { .. } | DefKind::ForeignMod => cur_did = parent,
500+
// items defined in these can be linked to, as long as they are visible
501+
DefKind::Mod | DefKind::ForeignMod => cur_did = parent,
502+
// items in impls can be linked to,
503+
// as long as we can link to the item the impl is on.
504+
// since associated traits are not a thing,
505+
// it should not be possible to refer to an impl item if
506+
// the base type is not namable.
507+
DefKind::Impl { .. } => return false,
502508
// everything else does not have docs generated for it
503509
_ => return true,
504510
}

0 commit comments

Comments
 (0)