diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-03-02 21:23:12 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-02 21:23:12 +0900 |
| commit | bc5669eef8c1d747e82694547fd57a1400a5afec (patch) | |
| tree | 6e68ce12e4a6ab82bf75d9ddf573ee86584aef37 /library/std/src | |
| parent | ef0d5924c25b500b2b135e5a5f41754ab4a72e26 (diff) | |
| parent | 4d46735b8efb7e8591387447315037094a094d50 (diff) | |
| download | rust-bc5669eef8c1d747e82694547fd57a1400a5afec.tar.gz rust-bc5669eef8c1d747e82694547fd57a1400a5afec.zip | |
Rollup merge of #80189 - jyn514:convert-primitives, r=poliorcetics
Convert primitives in the standard library to intra-doc links Blocked on https://github.com/rust-lang/rust/pull/80181. I forgot that this needs to wait for the beta bump so the standard library can be documented with `doc --stage 0`. Notably I didn't convert `core::slice` because it's like 50 links and I got scared :fearful:
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/ffi/c_str.rs | 6 | ||||
| -rw-r--r-- | library/std/src/io/mod.rs | 3 | ||||
| -rw-r--r-- | library/std/src/keyword_docs.rs | 8 | ||||
| -rw-r--r-- | library/std/src/lib.rs | 12 | ||||
| -rw-r--r-- | library/std/src/primitive_docs.rs | 6 |
5 files changed, 15 insertions, 20 deletions
diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs index 230ef0b23db..945bfda1b78 100644 --- a/library/std/src/ffi/c_str.rs +++ b/library/std/src/ffi/c_str.rs @@ -62,20 +62,18 @@ use crate::sys; /// u8` argument which is not necessarily nul-terminated, plus another /// argument with the length of the string — like C's `strndup()`. /// You can of course get the slice's length with its -/// [`len`][slice.len] method. +/// [`len`][slice::len] method. /// /// If you need a `&[`[`u8`]`]` slice *with* the nul terminator, you /// can use [`CString::as_bytes_with_nul`] instead. /// /// Once you have the kind of slice you need (with or without a nul /// terminator), you can call the slice's own -/// [`as_ptr`][slice.as_ptr] method to get a read-only raw pointer to pass to +/// [`as_ptr`][slice::as_ptr] method to get a read-only raw pointer to pass to /// extern functions. See the documentation for that function for a /// discussion on ensuring the lifetime of the raw pointer. /// /// [`&str`]: prim@str -/// [slice.as_ptr]: ../primitive.slice.html#method.as_ptr -/// [slice.len]: ../primitive.slice.html#method.len /// [`Deref`]: ops::Deref /// [`&CStr`]: CStr /// diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index db3b0e2628f..22914987405 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -482,7 +482,7 @@ pub(crate) fn default_read_exact<R: Read + ?Sized>(this: &mut R, mut buf: &mut [ /// } /// ``` /// -/// Read from [`&str`] because [`&[u8]`][slice] implements `Read`: +/// Read from [`&str`] because [`&[u8]`][prim@slice] implements `Read`: /// /// ```no_run /// # use std::io; @@ -504,7 +504,6 @@ pub(crate) fn default_read_exact<R: Read + ?Sized>(this: &mut R, mut buf: &mut [ /// [`&str`]: prim@str /// [`std::io`]: self /// [`File`]: crate::fs::File -/// [slice]: ../../std/primitive.slice.html #[stable(feature = "rust1", since = "1.0.0")] #[doc(spotlight)] pub trait Read { diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 6b06539a094..383eaf2e3a2 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -42,7 +42,7 @@ /// [Reference]: ../reference/expressions/operator-expr.html#type-cast-expressions /// [`crate`]: keyword.crate.html /// [`use`]: keyword.use.html -/// [const-cast]: primitive.pointer.html#method.cast +/// [const-cast]: pointer::cast /// [mut-cast]: primitive.pointer.html#method.cast-1 mod as_keyword {} @@ -181,9 +181,8 @@ mod break_keyword {} /// The `const` keyword is also used in raw pointers in combination with `mut`, as seen in `*const /// T` and `*mut T`. More about `const` as used in raw pointers can be read at the Rust docs for the [pointer primitive]. /// -/// [pointer primitive]: primitive.pointer.html -/// [Rust Book]: -/// ../book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants +/// [pointer primitive]: pointer +/// [Rust Book]: ../book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants /// [Reference]: ../reference/items/constant-items.html /// [const-eval]: ../reference/const_eval.html mod const_keyword {} @@ -371,7 +370,6 @@ mod else_keyword {} /// [ADT]: https://en.wikipedia.org/wiki/Algebraic_data_type /// [Rust Book]: ../book/ch06-01-defining-an-enum.html /// [Reference]: ../reference/items/enumerations.html -/// [`!`]: primitive.never.html mod enum_keyword {} #[doc(keyword = "extern")] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 63b65d8b413..ba49dee38e6 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -61,14 +61,14 @@ //! type, but not the all-important methods. //! //! So for example there is a [page for the primitive type -//! `i32`](primitive.i32.html) that lists all the methods that can be called on +//! `i32`](primitive::i32) that lists all the methods that can be called on //! 32-bit integers (very useful), and there is a [page for the module //! `std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely //! useful). //! -//! Note the documentation for the primitives [`str`] and [`[T]`][slice] (also +//! Note the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also //! called 'slice'). Many method calls on [`String`] and [`Vec<T>`] are actually -//! calls to methods on [`str`] and [`[T]`][slice] respectively, via [deref +//! calls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref //! coercions][deref-coercions]. //! //! Third, the standard library defines [The Rust Prelude], a small collection @@ -111,8 +111,8 @@ //! regions of memory: //! //! * [`Vec<T>`] - A heap-allocated *vector* that is resizable at runtime. -//! * [`[T; n]`][array] - An inline *array* with a fixed size at compile time. -//! * [`[T]`][slice] - A dynamically sized *slice* into any other kind of contiguous +//! * [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time. +//! * [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous //! storage, whether heap-allocated or not. //! //! Slices can only be handled through some kind of *pointer*, and as such come @@ -275,7 +275,7 @@ #![feature(int_error_matching)] #![feature(integer_atomics)] #![feature(into_future)] -#![cfg_attr(not(bootstrap), feature(intra_doc_pointers))] +#![feature(intra_doc_pointers)] #![feature(lang_items)] #![feature(link_args)] #![feature(linkage)] diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index 876b2b8a3f6..d4bb2083d00 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -468,8 +468,8 @@ mod prim_unit {} /// /// [`null`]: ptr::null /// [`null_mut`]: ptr::null_mut -/// [`is_null`]: ../std/primitive.pointer.html#method.is_null -/// [`offset`]: ../std/primitive.pointer.html#method.offset +/// [`is_null`]: pointer::is_null +/// [`offset`]: pointer::offset /// [`into_raw`]: Box::into_raw /// [`drop`]: mem::drop /// [`write`]: ptr::write @@ -564,7 +564,7 @@ mod prim_pointer {} /// move_away(roa); /// ``` /// -/// [slice]: primitive.slice.html +/// [slice]: prim@slice /// [`Debug`]: fmt::Debug /// [`Hash`]: hash::Hash /// [`Borrow`]: borrow::Borrow |
