Description
I was chatting with @compiler-errors on twitter about #87073. In retrospect I think the whole thing was overcomplicated and we can get the equivalent behavior much more simply by treating documentation on the re-exports in core::primitive as docs for the primitive items themselves, just like for normal re-exports.
This does mean we have to do something like
pub use core::primitive::usize;
pub use core::primitive::isize;
// ...
in std::primitive rather than just use core::primitive::*;
. But that seems pretty simple compared to all the current special casing.
The last thing to deal with here is overwriting the docs instead of appending - I think that would need a new nightly rustdoc feature, but it would be pretty simple to implement, basically just an if
condition in try_inline
for this line:
rust/src/librustdoc/clean/inline.rs
Line 304 in 3b98c08
So, an overview of all that:
- Treat docs on re-exports of primitives as docs for the primitive themselves. This should probably be behind a feature gate.
- Add a way to overwrite docs instead of appending in rustdoc, rather than special casing primitives only. This is probably useful just on its own, but should still be feature gated at first.
- Remove all the
mod bool
hackery in std and rustdoc; add docs to the re-exports incore::primitive
.
@rust-lang/rustdoc I don't plan to work on this, but does it make sense / sound like a good idea?