-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
Checking hidden/private items in rustdoc can be useful even if no docs are generated/displayed for them. For instance to detect broken intra-doc links there: someone may try to link something that didn't exist, for instance because there was a typo, or the docs became outdated, etc.
It is also nice when something is made public or un-hidden, or when the docs are copy-pasted to somewhere else, i.e. they would have a higher chance of working. Put another way, not checking means that the hidden/private items are, in a sense, less strict.
The fact that they are not checked can be surprising on its own. For instance, there was a brief period of time in 1.92's nightlies when checking actually took place by mistake [1][2], which made @BennoLossin send a fix for it, wondering why previous versions didn't catch it [3].
This can be worked around by doing two passes (i.e. one for checking, and one for the actual generation) with the --document-{hidden,private}-items flags (suggested by Guillaume). However, that requires two passes where one (the bigger one, in fact) will be simply discarded.
A related feature that can cover this one for some projects is the "Runtime toggle for private/hidden items documentation (and /* private fields */)" one, i.e. if there was a runtime toggle to see the private/hidden items, then the docs for those would of course have been checked already even if most users do not see/read them. That feature on its own is something that would be quite interesting [4].
[1] #147153 (comment)
[2] #147809
[3] https://lore.kernel.org/all/20251016211740.653599-1-lossin@kernel.org/T/
[4] #149106
Cc @GuillaumeGomez @fmease @lolbinarycat
@rustbot label T-rustdoc
@rustbot label A-intra-doc-links
@rustbot label A-rust-for-linux