Skip to content

Commit 69fe39e

Browse files
committed
Add primitive documentation to libcore
This works by doing two things: - Adding links that are specific to the crate. Since not all primitive items are defined in `core` (due to lang_items), these need to use relative links and not intra-doc links. - Duplicating `primitive_docs` in both core and std. This allows not needing CARGO_PKG_NAME to build the standard library. It also adds a tidy check to make sure they stay the same.
1 parent 8c2b6ea commit 69fe39e

29 files changed

+1394
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/boxed/struct.Box.html#method.into_raw
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/fs/struct.File.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/io/trait.BufRead.html
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/io/trait.Read.html
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/io/trait.Seek.html
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/io/trait.Write.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/net/trait.ToSocketAddrs.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/process/fn.exit.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../std/string/struct.String.html

library/core/src/bool.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
33
#[lang = "bool"]
44
impl bool {
5-
/// Returns `Some(t)` if the `bool` is [`true`](keyword.true.html), or `None` otherwise.
5+
/// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
6+
/// or `None` otherwise.
67
///
78
/// # Examples
89
///
@@ -18,7 +19,8 @@ impl bool {
1819
if self { Some(t) } else { None }
1920
}
2021

21-
/// Returns `Some(f())` if the `bool` is [`true`](keyword.true.html), or `None` otherwise.
22+
/// Returns `Some(f())` if the `bool` is [`true`](../std/keyword.true.html),
23+
/// or `None` otherwise.
2224
///
2325
/// # Examples
2426
///

library/core/src/char/methods.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl char {
9696
/// Converts a `u32` to a `char`.
9797
///
9898
/// Note that all `char`s are valid [`u32`]s, and can be cast to one with
99-
/// [`as`](keyword.as.html):
99+
/// [`as`](../std/keyword.as.html):
100100
///
101101
/// ```
102102
/// let c = '💯';
@@ -372,7 +372,7 @@ impl char {
372372
/// println!("\\u{{2764}}");
373373
/// ```
374374
///
375-
/// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
375+
/// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
376376
///
377377
/// ```
378378
/// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}");
@@ -448,7 +448,7 @@ impl char {
448448
/// println!("\\n");
449449
/// ```
450450
///
451-
/// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
451+
/// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
452452
///
453453
/// ```
454454
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
@@ -502,7 +502,7 @@ impl char {
502502
/// println!("\\\"");
503503
/// ```
504504
///
505-
/// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
505+
/// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
506506
///
507507
/// ```
508508
/// assert_eq!('"'.escape_default().to_string(), "\\\"");
@@ -937,7 +937,7 @@ impl char {
937937
/// println!("i\u{307}");
938938
/// ```
939939
///
940-
/// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
940+
/// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
941941
///
942942
/// ```
943943
/// assert_eq!('C'.to_lowercase().to_string(), "c");
@@ -1002,7 +1002,7 @@ impl char {
10021002
/// println!("SS");
10031003
/// ```
10041004
///
1005-
/// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
1005+
/// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
10061006
///
10071007
/// ```
10081008
/// assert_eq!('c'.to_uppercase().to_string(), "C");

library/core/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
#![feature(decl_macro)]
131131
#![feature(doc_cfg)]
132132
#![feature(doc_notable_trait)]
133+
#![feature(doc_primitive)]
133134
#![feature(exhaustive_patterns)]
134135
#![feature(extern_types)]
135136
#![feature(fundamental)]
@@ -355,3 +356,5 @@ pub mod arch {
355356
/* compiler built-in */
356357
}
357358
}
359+
360+
include!("primitive_docs.rs");

0 commit comments

Comments
 (0)