diff options
| author | binarycat <binarycat@envs.net> | 2025-07-19 14:26:47 -0500 |
|---|---|---|
| committer | binarycat <binarycat@envs.net> | 2025-07-22 17:11:48 -0500 |
| commit | 05a62c8a1172795709219aa5afc833eb1ab57c25 (patch) | |
| tree | a24f3ed281e4736aede29e648c8d2c9b46e9aa17 | |
| parent | f57283d6141fcc430e739fc2ad633e8997a66310 (diff) | |
| download | rust-05a62c8a1172795709219aa5afc833eb1ab57c25.tar.gz rust-05a62c8a1172795709219aa5afc833eb1ab57c25.zip | |
impl items are never unnamable
| -rw-r--r-- | src/librustdoc/html/format.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 90d385aa135..457af8e994d 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -486,8 +486,14 @@ fn is_unnamable(tcx: TyCtxt<'_>, did: DefId) -> bool { let mut cur_did = did; while let Some(parent) = tcx.opt_parent(cur_did) { match tcx.def_kind(parent) { - // items defined in these can be linked to - DefKind::Mod | DefKind::Impl { .. } | DefKind::ForeignMod => cur_did = parent, + // items defined in these can be linked to, as long as they are visible + DefKind::Mod | DefKind::ForeignMod => cur_did = parent, + // items in impls can be linked to, + // as long as we can link to the item the impl is on. + // since associated traits are not a thing, + // it should not be possible to refer to an impl item if + // the base type is not namable. + DefKind::Impl { .. } => return false, // everything else does not have docs generated for it _ => return true, } |
