You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Closesrust-lang#14474
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. Thestd::str
module is especially problematic, since it provides aStr
trait with the soleas_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.
The text was updated successfully, but these errors were encountered: