rust/src/librustdoc/clean
bors 2e055d92e0 Auto merge of #91094 - inquisitivecrystal:rustdoc-top-mod, r=jyn514
Avoid documenting top-level private imports

PR #88447 aimed to make rustdoc's `--document-private-items` mode only document imports that are visible outside the importing module. Unfortunately, I inadvertently set things up so that imports at the crate top-level are always documented, regardless of their visibility. This behavior was unintended and is [not desirable](https://github.com/rust-lang/rust/issues/90865#issuecomment-971172649).

This PR treats top-level imports as never being visible outside their parent module. In practice, the only way a top-level import can be visible externally is if it's fully public, and there's a seperate check for that.

It's worth calling attention to the fact that this change means that `pub(crate)` imports will be visible in lower level modules, but not at the top-level. This is because, at the top level of the crate, `pub(crate)` means the same thing as `pub(self)`.

It turned out that there were existing tests checking for the only behavior, which I didn't notice at the time of my previous PR. I have updated them to check for the new behavior and substantially extended them to handle differences between the top-level module and lower level modules. I may have gone overboard, so please tell me if there's anything I should cut.

r? `@jyn514`

Fixes #90865.
2021-11-23 03:13:26 +00:00
..
cfg Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
utils Valid underscores in hex/octal/binary literal docs 2021-05-03 20:11:09 -04:00
auto_trait.rs rustdoc: Use ty::ImplPolarity instead of custom enum 2021-11-07 08:57:33 -08:00
blanket_impl.rs Remove Clean impl for Vec<T> 2021-11-07 09:19:58 -08:00
cfg.rs rustdoc: Add human-readable cfg string for m68k 2021-09-17 15:07:13 +00:00
inline.rs Auto merge of #90844 - camelid:cleanup-vis, r=jyn514 2021-11-21 13:26:31 +00:00
mod.rs Auto merge of #91094 - inquisitivecrystal:rustdoc-top-mod, r=jyn514 2021-11-23 03:13:26 +00:00
simplify.rs Replace all uses of path.res.def_id() with path.def_id() 2021-10-02 15:57:57 -07:00
types.rs Auto merge of #91073 - camelid:small-cleanups, r=jyn514 2021-11-21 01:22:59 +00:00
utils.rs Auto merge of #90844 - camelid:cleanup-vis, r=jyn514 2021-11-21 13:26:31 +00:00