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

rustdoc: provide anchors for primitive types #14474

Closed
aturon opened this issue May 27, 2014 · 2 comments
Closed

rustdoc: provide anchors for primitive types #14474

aturon opened this issue May 27, 2014 · 2 comments
Labels
P-low Low priority T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@aturon
Copy link
Member

aturon commented May 27, 2014

rustdoc should have a landing page for primitive types.

Currently, there is nowhere to look in rustdoc for the list of methods that apply to &str, u8, or other primitive types. The std::str module is especially problematic, since it provides a Str trait with the sole as_slice method, which is very confusing to newcomers.

See #11409 for an earlier attempt to address this problem.

#6065 and #11526 may also be related.

I think this needs to happen before 1.0. Nominating.

@aturon
Copy link
Member Author

aturon commented May 27, 2014

cc @bjz

@brson
Copy link
Contributor

brson commented May 29, 2014

1.0 P-low

alexcrichton added a commit to alexcrichton/rust that referenced this issue May 30, 2014
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-low Low priority 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

2 participants