about summary refs log tree commit diff
path: root/src/libstd/str.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-28 19:53:37 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-31 21:59:50 -0700
commitc2e3aa37daedf698072b4aadbc420f24505b2b2d (patch)
tree2821fa90613a5e130e2074de7be74740ed541bb1 /src/libstd/str.rs
parentba9be0a72bd4aabb67e9b72edd261b2fe449dc86 (diff)
downloadrust-c2e3aa37daedf698072b4aadbc420f24505b2b2d.tar.gz
rust-c2e3aa37daedf698072b4aadbc420f24505b2b2d.zip
rustdoc: Create anchor pages for primitive types
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 #14474
Diffstat (limited to 'src/libstd/str.rs')
-rw-r--r--src/libstd/str.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index a35b4e7a151..11b9d0e85ff 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -65,6 +65,8 @@ is the same as `&[u8]`.
 
 */
 
+#![doc(primitive = "str")]
+
 use char::Char;
 use char;
 use clone::Clone;