Skip to content

Commit bc5669e

Browse files
authored
Rollup merge of rust-lang#80189 - jyn514:convert-primitives, r=poliorcetics
Convert primitives in the standard library to intra-doc links Blocked on rust-lang#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 😨
2 parents ef0d592 + 4d46735 commit bc5669e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+174
-210
lines changed

library/alloc/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@
104104
#![feature(fundamental)]
105105
#![feature(inplace_iteration)]
106106
#![feature(int_bits_const)]
107+
// Technically, this is a bug in rustdoc: rustdoc sees the documentation on `#[lang = slice_alloc]`
108+
// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad
109+
// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs
110+
// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing.
111+
#![feature(intra_doc_pointers)]
107112
#![feature(lang_items)]
108113
#![feature(layout_for_ptr)]
109114
#![feature(maybe_uninit_ref)]

library/alloc/src/slice.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! A dynamically-sized view into a contiguous sequence, `[T]`.
22
//!
3-
//! *[See also the slice primitive type](../../std/primitive.slice.html).*
3+
//! *[See also the slice primitive type](slice).*
44
//!
55
//! Slices are a view into a block of memory represented as a pointer and a
66
//! length.
@@ -71,12 +71,12 @@
7171
//! [`.chunks`], [`.windows`] and more.
7272
//!
7373
//! [`Hash`]: core::hash::Hash
74-
//! [`.iter`]: ../../std/primitive.slice.html#method.iter
75-
//! [`.iter_mut`]: ../../std/primitive.slice.html#method.iter_mut
76-
//! [`.split`]: ../../std/primitive.slice.html#method.split
77-
//! [`.splitn`]: ../../std/primitive.slice.html#method.splitn
78-
//! [`.chunks`]: ../../std/primitive.slice.html#method.chunks
79-
//! [`.windows`]: ../../std/primitive.slice.html#method.windows
74+
//! [`.iter`]: slice::iter
75+
//! [`.iter_mut`]: slice::iter_mut
76+
//! [`.split`]: slice::split
77+
//! [`.splitn`]: slice::splitn
78+
//! [`.chunks`]: slice::chunks
79+
//! [`.windows`]: slice::windows
8080
#![stable(feature = "rust1", since = "1.0.0")]
8181
// Many of the usings in this module are only used in the test configuration.
8282
// It's cleaner to just turn off the unused_imports warning than to fix them.
@@ -673,7 +673,7 @@ impl [u8] {
673673
// Extension traits for slices over specific kinds of data
674674
////////////////////////////////////////////////////////////////////////////////
675675

676-
/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat).
676+
/// Helper trait for [`[T]::concat`](slice::concat).
677677
///
678678
/// Note: the `Item` type parameter is not used in this trait,
679679
/// but it allows impls to be more generic.
@@ -708,19 +708,19 @@ pub trait Concat<Item: ?Sized> {
708708
/// The resulting type after concatenation
709709
type Output;
710710

711-
/// Implementation of [`[T]::concat`](../../std/primitive.slice.html#method.concat)
711+
/// Implementation of [`[T]::concat`](slice::concat)
712712
#[unstable(feature = "slice_concat_trait", issue = "27747")]
713713
fn concat(slice: &Self) -> Self::Output;
714714
}
715715

716-
/// Helper trait for [`[T]::join`](../../std/primitive.slice.html#method.join)
716+
/// Helper trait for [`[T]::join`](slice::join)
717717
#[unstable(feature = "slice_concat_trait", issue = "27747")]
718718
pub trait Join<Separator> {
719719
#[unstable(feature = "slice_concat_trait", issue = "27747")]
720720
/// The resulting type after concatenation
721721
type Output;
722722

723-
/// Implementation of [`[T]::join`](../../std/primitive.slice.html#method.join)
723+
/// Implementation of [`[T]::join`](slice::join)
724724
#[unstable(feature = "slice_concat_trait", issue = "27747")]
725725
fn join(slice: &Self, sep: Separator) -> Self::Output;
726726
}

library/alloc/src/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Unicode string slices.
22
//!
3-
//! *[See also the `str` primitive type](../../std/primitive.str.html).*
3+
//! *[See also the `str` primitive type](str).*
44
//!
55
//! The `&str` type is one of the two main string types, the other being `String`.
66
//! Unlike its `String` counterpart, its contents are borrowed.

library/alloc/src/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl String {
495495
/// `from_utf8_lossy()` will replace any invalid UTF-8 sequences with
496496
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], which looks like this: �
497497
///
498-
/// [byteslice]: ../../std/primitive.slice.html
498+
/// [byteslice]: prim@slice
499499
/// [U+FFFD]: core::char::REPLACEMENT_CHARACTER
500500
///
501501
/// If you are sure that the byte slice is valid UTF-8, and you don't want

library/alloc/src/vec/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ mod spec_extend;
216216
/// # Slicing
217217
///
218218
/// A `Vec` can be mutable. Slices, on the other hand, are read-only objects.
219-
/// To get a [slice], use [`&`]. Example:
219+
/// To get a [slice][prim@slice], use [`&`]. Example:
220220
///
221221
/// ```
222222
/// fn read_slice(slice: &[usize]) {
@@ -369,8 +369,6 @@ mod spec_extend;
369369
/// [`reserve`]: Vec::reserve
370370
/// [`MaybeUninit`]: core::mem::MaybeUninit
371371
/// [owned slice]: Box
372-
/// [slice]: ../../std/primitive.slice.html
373-
/// [`&`]: ../../std/primitive.reference.html
374372
#[stable(feature = "rust1", since = "1.0.0")]
375373
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_type")]
376374
pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
@@ -2517,7 +2515,7 @@ impl<T, A: Allocator> Vec<T, A> {
25172515
/// This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] to
25182516
/// append the entire slice at once.
25192517
///
2520-
/// [`copy_from_slice`]: ../../std/primitive.slice.html#method.copy_from_slice
2518+
/// [`copy_from_slice`]: slice::copy_from_slice
25212519
#[stable(feature = "extend_ref", since = "1.2.0")]
25222520
impl<'a, T: Copy + 'a, A: Allocator + 'a> Extend<&'a T> for Vec<T, A> {
25232521
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {

library/core/src/alloc/layout.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ impl Layout {
164164
/// [`Layout::for_value`] on a reference to an extern type tail.
165165
/// - otherwise, it is conservatively not allowed to call this function.
166166
///
167-
/// [slice]: ../../std/primitive.slice.html
168167
/// [trait object]: ../../book/ch17-02-trait-objects.html
169168
/// [extern type]: ../../unstable-book/language-features/extern-types.html
170169
#[unstable(feature = "layout_for_ptr", issue = "69835")]

library/core/src/array/iter.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ use crate::{
99
};
1010

1111
/// A by-value [array] iterator.
12-
///
13-
/// [array]: ../../std/primitive.array.html
1412
#[stable(feature = "array_value_iter", since = "1.51.0")]
1513
pub struct IntoIter<T, const N: usize> {
1614
/// This is the array we are iterating over.

library/core/src/array/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! up to a certain length. Eventually, we should be able to generalize
33
//! to all lengths.
44
//!
5-
//! *[See also the array primitive type](../../std/primitive.array.html).*
5+
//! *[See also the array primitive type](array).*
66
77
#![stable(feature = "core_array", since = "1.36.0")]
88

library/core/src/char/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
//! [Unicode code point]: http://www.unicode.org/glossary/#code_point
1010
//!
1111
//! This module exists for technical reasons, the primary documentation for
12-
//! `char` is directly on [the `char` primitive type](../../std/primitive.char.html)
13-
//! itself.
12+
//! `char` is directly on [the `char` primitive type][char] itself.
1413
//!
1514
//! This module is the home of the iterator implementations for the iterators
1615
//! implemented on `char`, as well as some useful constants and conversion

library/core/src/convert/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ pub trait TryInto<T>: Sized {
463463
/// ```
464464
///
465465
/// [`try_from`]: TryFrom::try_from
466-
/// [`!`]: ../../std/primitive.never.html
467466
#[rustc_diagnostic_item = "try_from_trait"]
468467
#[stable(feature = "try_from", since = "1.34.0")]
469468
pub trait TryFrom<T>: Sized {
@@ -673,8 +672,6 @@ impl AsMut<str> for str {
673672
/// However when `Infallible` becomes an alias for the never type,
674673
/// the two `impl`s will start to overlap
675674
/// and therefore will be disallowed by the language’s trait coherence rules.
676-
///
677-
/// [never]: ../../std/primitive.never.html
678675
#[stable(feature = "convert_infallible", since = "1.34.0")]
679676
#[derive(Copy)]
680677
pub enum Infallible {}

0 commit comments

Comments
 (0)