-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustdoc: Create anchor pages for primitive types #14513
Conversation
Yay! The docs for |
This doesn't seem to handle tuples. |
fn from_str(s: &str) -> Option<Primitive> { | ||
match s.as_slice() { | ||
"int" => Some(Int), | ||
"i8" => Some(Int), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fyi, Exhibit a is missing i8
and lists int
twice and this might be the cause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, thanks!
Updated with comments (will rebase upwards afterwards) |
ping r? |
r=me with comments |
Thanks @huonw for reviewing! |
This is currently rebased on top of #14478, but that's just to preemptively avoid rebase conflicts and to provide a better preview. This can land independently of that PR. This change crates a dedicated page in rustdoc for primitive types to outline everything you can do with them (at least in a basic way). * Preview - http://people.mozilla.org/~acrichton/doc/ * Exhibit A - http://people.mozilla.org/~acrichton/doc/std/#primitives * Exhibit B - http://people.mozilla.org/~acrichton/doc/std/primitive.str.html * Exhibit C - http://people.mozilla.org/~acrichton/doc/std/primitive.slice.html Please don't hesitate to be nitpickity, it's easy to overlook a thing here or there!
Instead of one giant function, this breaks it up into several smaller functions which have explicit dependencies among one another. There are no code changes as a result of this commit.
The cache is going to be used earlier in the HTML generation process, which means that it needs to get into TLS as soon as possible.
When inlining documentation across crates, primitive implementors of traits were not shown. This commit tweaks the infrastructure to treat primitive and Path-like impls the same way, displaying all implementors everywhere. cc rust-lang#14462
Type parameters were filled in for some areas, but not all. This commit unifies the two code paths to fill in type parameters everywhere. Closes rust-lang#14508
This commit adds support in rustdoc to recognize the `#[doc(primitive = "foo")]` attribute. This attribute indicates that the current module is the "owner" of the primitive type `foo`. For rustdoc, this means that the doc-comment for the module is the doc-comment for the primitive type, plus a signal to all downstream crates that hyperlinks for primitive types will be directed at the crate containing the `#[doc]` directive. Additionally, rustdoc will favor crates closest to the one being documented which "implements the primitive type". For example, documentation of libcore links to libcore for primitive types, but documentation for libstd and beyond all links to libstd for primitive types. This change involves no compiler modifications, it is purely a rustdoc change. The landing pages for the primitive types primarily serve to show a list of implemented traits for the primitive type itself. The primitive types documented includes both strings and slices in a semi-ad-hoc way, but in a way that should provide at least somewhat meaningful documentation. Closes rust-lang#14474
This prevents structures like RcBox from showing up in the documentation
There is currently no way to query all impls for a type from an external crate, and with primitive types in play this is also quite difficult. Instead of filtering, just suck in all impls from upstream crates into the local AST, and have them get stripped later. This will allow population of all implementations of traits for primitive types, as well as filling in some corner cases with inlining documentation in other cases.
Cross crate links can target items which are not rendered in the documentation. If the item is reexported at a higher level, the destination of the link (a concatenation of the fully qualified name) may actually lead to nowhere. This fixes this problem by altering rustdoc to emit pages which redirect to the local copy of the reexported structure. cc rust-lang#14515 Closes rust-lang#14137
These don't actually point to anything, so there's no need to inline them.
This is currently rebased on top of #14478, but that's just to preemptively avoid rebase conflicts and to provide a better preview. This can land independently of that PR. This change crates a dedicated page in rustdoc for primitive types to outline everything you can do with them (at least in a basic way). * Preview - http://people.mozilla.org/~acrichton/doc/ * Exhibit A - http://people.mozilla.org/~acrichton/doc/std/#primitives * Exhibit B - http://people.mozilla.org/~acrichton/doc/std/primitive.str.html * Exhibit C - http://people.mozilla.org/~acrichton/doc/std/primitive.slice.html Please don't hesitate to be nitpickity, it's easy to overlook a thing here or there!
…2, r=Veykril doc(alias)-based completion round 2 Follow-up on rust-lang#14433 We can now complete fields, functions and some use/mods. Flyimports don't behave, I don't really have the time to understand the structure there either. While reading the flyimport code, I removed one method only used there, the closure-tree was a bit confusing, I can revert that if you want.
This is currently rebased on top of #14478, but that's just to preemptively avoid rebase conflicts and to provide a better preview. This can land independently of that PR.
This change crates a dedicated page in rustdoc for primitive types to outline everything you can do with them (at least in a basic way).
Please don't hesitate to be nitpickity, it's easy to overlook a thing here or there!