Skip to content

Commit 9a75f4f

Browse files
committed
Convert primitives to use intra-doc links
1 parent c0a54cc commit 9a75f4f

File tree

26 files changed

+46
-72
lines changed

26 files changed

+46
-72
lines changed

library/alloc/src/lib.rs

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

library/core/src/ffi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use crate::ops::{Deref, DerefMut};
2121
/// compiler down to 1.1.0. After Rust 1.30.0, it was re-exported by
2222
/// this definition. For more information, please read [RFC 2521].
2323
///
24-
/// [pointer]: ../../std/primitive.pointer.html
2524
/// [Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
2625
/// [RFC 2521]: https://github.com/rust-lang/rfcs/blob/master/text/2521-c_void-reunification.md
2726
// N.B., for LLVM to recognize the void pointer type and by extension

0 commit comments

Comments
 (0)