Skip to content

Commit 05a62c8

Browse files
committed
impl items are never unnamable
1 parent f57283d commit 05a62c8

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
@@ -486,8 +486,14 @@ fn is_unnamable(tcx: TyCtxt<'_>, did: DefId) -> bool {
486486
let mut cur_did = did;
487487
while let Some(parent) = tcx.opt_parent(cur_did) {
488488
match tcx.def_kind(parent) {
489-
// items defined in these can be linked to
490-
DefKind::Mod | DefKind::Impl { .. } | DefKind::ForeignMod => cur_did = parent,
489+
// items defined in these can be linked to, as long as they are visible
490+
DefKind::Mod | DefKind::ForeignMod => cur_did = parent,
491+
// items in impls can be linked to,
492+
// as long as we can link to the item the impl is on.
493+
// since associated traits are not a thing,
494+
// it should not be possible to refer to an impl item if
495+
// the base type is not namable.
496+
DefKind::Impl { .. } => return false,
491497
// everything else does not have docs generated for it
492498
_ => return true,
493499
}

0 commit comments

Comments
 (0)