rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97k stars 12.54k forks source link

rustdoc::clean is missing glob re-exports #130360

Open lolbinarycat opened 1 week ago

lolbinarycat commented 1 week ago

Location

https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/index.html

Summary

items like clean::Item should show up here, but they do not, they only show up at their original definition site, clean::types::Item.

possibly related: https://github.com/rust-lang/rust/issues/53724

fmease commented 1 week ago

I think this is intentional given the fact that the types "re-export" (well, import) is only crate-public, not public. It's pub(crate) use self::types::*; in clean/mod.rs.

Indeed, rustc, rustdoc etc get documented with --document-private-items. However, we never render non-public uses[^1]. A case could be made that we should inspect the visibility more closely but eh, dunno (and it wouldn't work for root modules / crate roots as there, the following holds: pub(crate) use == pub(self) use == use).

[^1]: Edit: I guess there are cases where we do ^^, e.g. with #[doc(no_inline)], maybe