Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of doc(primitive) #98248

Closed
jyn514 opened this issue Jun 19, 2022 · 7 comments
Closed

Get rid of doc(primitive) #98248

jyn514 opened this issue Jun 19, 2022 · 7 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Jun 19, 2022

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:

both.extend_from_slice(old_attrs);

So, an overview of all that:

  1. Treat docs on re-exports of primitives as docs for the primitive themselves. This should probably be behind a feature gate.
  2. 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.
  3. Remove all the mod bool hackery in std and rustdoc; add docs to the re-exports in core::primitive.

@rust-lang/rustdoc I don't plan to work on this, but does it make sense / sound like a good idea?

@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 19, 2022
@GuillaumeGomez
Copy link
Member

I think this would simplify things a lot. I didn't think it's a great idea and I'm all for it!

@GuillaumeGomez
Copy link
Member

Just one thing I wonder: will this documentation remain available in core too? I think we can reexport primitives in core for their documentation to be displayed but better be sure.

@jyn514
Copy link
Member Author

jyn514 commented Jun 19, 2022

Yes, they're already there: https://doc.rust-lang.org/stable/core/primitive/index.html

@GuillaumeGomez
Copy link
Member

Perfect! Then there is really nothing preventing us from doing it.

@Stupremee
Copy link
Member

How would you handle primitives that aren't re-exported from core::primitive, like fn, slice, etc.?

@jyn514
Copy link
Member Author

jyn514 commented Jun 20, 2022

Oh, that's a good point :( maybe this wouldn't work

@jyn514
Copy link
Member Author

jyn514 commented Aug 1, 2022

going to close this, don't have ideas on how to make non-path primitives work :(

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants