Skip to content

Commit ec62980

Browse files
authored
Rollup merge of #75725 - LeSeulArtichaut:alloc-intra-doc, r=jyn514
Use intra-doc-links in `alloc` I didn't have time to test this, so I will let the CI do it for me. r? @jyn514 cc #75080
2 parents 441c835 + 97072c6 commit ec62980

File tree

9 files changed

+116
-223
lines changed

9 files changed

+116
-223
lines changed

library/alloc/src/alloc.rs

-18
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ extern "Rust" {
3636
///
3737
/// Note: while this type is unstable, the functionality it provides can be
3838
/// accessed through the [free functions in `alloc`](index.html#functions).
39-
///
40-
/// [`AllocRef`]: trait.AllocRef.html
4139
#[unstable(feature = "allocator_api", issue = "32838")]
4240
#[derive(Copy, Clone, Default, Debug)]
4341
pub struct Global;
@@ -55,10 +53,6 @@ pub struct Global;
5553
///
5654
/// See [`GlobalAlloc::alloc`].
5755
///
58-
/// [`Global`]: struct.Global.html
59-
/// [`AllocRef`]: trait.AllocRef.html
60-
/// [`GlobalAlloc::alloc`]: trait.GlobalAlloc.html#tymethod.alloc
61-
///
6256
/// # Examples
6357
///
6458
/// ```
@@ -92,10 +86,6 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
9286
/// # Safety
9387
///
9488
/// See [`GlobalAlloc::dealloc`].
95-
///
96-
/// [`Global`]: struct.Global.html
97-
/// [`AllocRef`]: trait.AllocRef.html
98-
/// [`GlobalAlloc::dealloc`]: trait.GlobalAlloc.html#tymethod.dealloc
9989
#[stable(feature = "global_alloc", since = "1.28.0")]
10090
#[inline]
10191
pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
@@ -114,10 +104,6 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
114104
/// # Safety
115105
///
116106
/// See [`GlobalAlloc::realloc`].
117-
///
118-
/// [`Global`]: struct.Global.html
119-
/// [`AllocRef`]: trait.AllocRef.html
120-
/// [`GlobalAlloc::realloc`]: trait.GlobalAlloc.html#method.realloc
121107
#[stable(feature = "global_alloc", since = "1.28.0")]
122108
#[inline]
123109
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
@@ -137,10 +123,6 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
137123
///
138124
/// See [`GlobalAlloc::alloc_zeroed`].
139125
///
140-
/// [`Global`]: struct.Global.html
141-
/// [`AllocRef`]: trait.AllocRef.html
142-
/// [`GlobalAlloc::alloc_zeroed`]: trait.GlobalAlloc.html#method.alloc_zeroed
143-
///
144126
/// # Examples
145127
///
146128
/// ```

library/alloc/src/boxed.rs

+10-16
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,13 @@
118118
//! described in [rust-lang/unsafe-code-guidelines#198][ucg#198].
119119
//!
120120
//! [ucg#198]: https://github.com/rust-lang/unsafe-code-guidelines/issues/198
121-
//! [dereferencing]: ../../std/ops/trait.Deref.html
122-
//! [`Box`]: struct.Box.html
123-
//! [`Box<T>`]: struct.Box.html
124-
//! [`Box::<T>::from_raw(value)`]: struct.Box.html#method.from_raw
125-
//! [`Box::<T>::into_raw`]: struct.Box.html#method.into_raw
126-
//! [`Global`]: ../alloc/struct.Global.html
127-
//! [`Layout`]: ../alloc/struct.Layout.html
128-
//! [`Layout::for_value(&*value)`]: ../alloc/struct.Layout.html#method.for_value
121+
//! [dereferencing]: core::ops::Deref
122+
//! [`Box<T>`]: Box
123+
//! [`Box::<T>::from_raw(value)`]: Box::from_raw
124+
//! [`Box::<T>::into_raw`]: Box::into_raw
125+
//! [`Global`]: crate::alloc::Global
126+
//! [`Layout`]: crate::alloc::Layout
127+
//! [`Layout::for_value(&*value)`]: crate::alloc::Layout::for_value
129128
130129
#![stable(feature = "rust1", since = "1.0.0")]
131130

@@ -240,7 +239,6 @@ impl<T> Box<T> {
240239
/// Converts a `Box<T>` into a `Box<[T]>`
241240
///
242241
/// This conversion does not allocate on the heap and happens in place.
243-
///
244242
#[unstable(feature = "box_into_boxed_slice", issue = "71582")]
245243
pub fn into_boxed_slice(boxed: Box<T>) -> Box<[T]> {
246244
// *mut T and *mut [T; 1] have the same size and alignment
@@ -386,9 +384,8 @@ impl<T: ?Sized> Box<T> {
386384
/// }
387385
/// ```
388386
///
389-
/// [memory layout]: index.html#memory-layout
390-
/// [`Layout`]: ../alloc/struct.Layout.html
391-
/// [`Box::into_raw`]: struct.Box.html#method.into_raw
387+
/// [memory layout]: self#memory-layout
388+
/// [`Layout`]: crate::Layout
392389
#[stable(feature = "box_raw", since = "1.4.0")]
393390
#[inline]
394391
pub unsafe fn from_raw(raw: *mut T) -> Self {
@@ -433,8 +430,7 @@ impl<T: ?Sized> Box<T> {
433430
/// }
434431
/// ```
435432
///
436-
/// [memory layout]: index.html#memory-layout
437-
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
433+
/// [memory layout]: self#memory-layout
438434
#[stable(feature = "box_raw", since = "1.4.0")]
439435
#[inline]
440436
pub fn into_raw(b: Box<T>) -> *mut T {
@@ -478,8 +474,6 @@ impl<T: ?Sized> Box<T> {
478474
/// to call it as `Box::leak(b)` instead of `b.leak()`. This
479475
/// is so that there is no conflict with a method on the inner type.
480476
///
481-
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
482-
///
483477
/// # Examples
484478
///
485479
/// Simple usage:

library/alloc/src/collections/linked_list.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//! array-based containers are generally faster,
88
//! more memory efficient, and make better use of CPU cache.
99
//!
10-
//! [`Vec`]: ../../vec/struct.Vec.html
11-
//! [`VecDeque`]: ../vec_deque/struct.VecDeque.html
10+
//! [`Vec`]: crate::vec::Vec
11+
//! [`VecDeque`]: super::vec_deque::VecDeque
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

@@ -50,11 +50,8 @@ struct Node<T> {
5050

5151
/// An iterator over the elements of a `LinkedList`.
5252
///
53-
/// This `struct` is created by the [`iter`] method on [`LinkedList`]. See its
53+
/// This `struct` is created by [`LinkedList::iter()`]. See its
5454
/// documentation for more.
55-
///
56-
/// [`iter`]: struct.LinkedList.html#method.iter
57-
/// [`LinkedList`]: struct.LinkedList.html
5855
#[stable(feature = "rust1", since = "1.0.0")]
5956
pub struct Iter<'a, T: 'a> {
6057
head: Option<NonNull<Node<T>>>,
@@ -80,11 +77,8 @@ impl<T> Clone for Iter<'_, T> {
8077

8178
/// A mutable iterator over the elements of a `LinkedList`.
8279
///
83-
/// This `struct` is created by the [`iter_mut`] method on [`LinkedList`]. See its
80+
/// This `struct` is created by [`LinkedList::iter_mut()`]. See its
8481
/// documentation for more.
85-
///
86-
/// [`iter_mut`]: struct.LinkedList.html#method.iter_mut
87-
/// [`LinkedList`]: struct.LinkedList.html
8882
#[stable(feature = "rust1", since = "1.0.0")]
8983
pub struct IterMut<'a, T: 'a> {
9084
// We do *not* exclusively own the entire list here, references to node's `element`
@@ -109,7 +103,6 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
109103
/// (provided by the `IntoIterator` trait). See its documentation for more.
110104
///
111105
/// [`into_iter`]: struct.LinkedList.html#method.into_iter
112-
/// [`LinkedList`]: struct.LinkedList.html
113106
#[derive(Clone)]
114107
#[stable(feature = "rust1", since = "1.0.0")]
115108
pub struct IntoIter<T> {

library/alloc/src/fmt.rs

+13-22
Original file line numberDiff line numberDiff line change
@@ -501,31 +501,23 @@
501501
//! it would internally pass around this structure until it has been determined
502502
//! where output should go to.
503503
//!
504-
//! [`usize`]: ../../std/primitive.usize.html
505-
//! [`isize`]: ../../std/primitive.isize.html
506-
//! [`i8`]: ../../std/primitive.i8.html
507-
//! [`Display`]: trait.Display.html
508-
//! [`Binary`]: trait.Binary.html
509-
//! [`fmt::Result`]: type.Result.html
510-
//! [`Result`]: ../../std/result/enum.Result.html
511-
//! [`std::fmt::Error`]: struct.Error.html
512-
//! [`Formatter`]: struct.Formatter.html
513-
//! [`write!`]: ../../std/macro.write.html
514-
//! [`Debug`]: trait.Debug.html
515-
//! [`format!`]: ../../std/macro.format.html
516-
//! [`to_string`]: ../../std/string/trait.ToString.html
517-
//! [`writeln!`]: ../../std/macro.writeln.html
504+
//! [`fmt::Result`]: Result
505+
//! [`Result`]: core::result::Result
506+
//! [`std::fmt::Error`]: Error
507+
//! [`write!`]: core::write
508+
//! [`write`]: core::write
509+
//! [`format!`]: crate::format
510+
//! [`to_string`]: crate::string::ToString
511+
//! [`writeln!`]: core::writeln
518512
//! [`write_fmt`]: ../../std/io/trait.Write.html#method.write_fmt
519513
//! [`std::io::Write`]: ../../std/io/trait.Write.html
520514
//! [`print!`]: ../../std/macro.print.html
521515
//! [`println!`]: ../../std/macro.println.html
522516
//! [`eprint!`]: ../../std/macro.eprint.html
523517
//! [`eprintln!`]: ../../std/macro.eprintln.html
524-
//! [`write!`]: ../../std/macro.write.html
525-
//! [`format_args!`]: ../../std/macro.format_args.html
526-
//! [`fmt::Arguments`]: struct.Arguments.html
527-
//! [`write`]: fn.write.html
528-
//! [`format`]: fn.format.html
518+
//! [`format_args!`]: core::format_args
519+
//! [`fmt::Arguments`]: Arguments
520+
//! [`format`]: crate::format
529521
530522
#![stable(feature = "rust1", since = "1.0.0")]
531523

@@ -576,9 +568,8 @@ use crate::string;
576568
/// assert_eq!(s, "Hello, world!");
577569
/// ```
578570
///
579-
/// [`Arguments`]: struct.Arguments.html
580-
/// [`format_args!`]: ../../std/macro.format_args.html
581-
/// [`format!`]: ../../std/macro.format.html
571+
/// [`format_args!`]: core::format_args
572+
/// [`format!`]: crate::format
582573
#[stable(feature = "rust1", since = "1.0.0")]
583574
pub fn format(args: Arguments<'_>) -> string::String {
584575
let capacity = args.estimated_capacity();

library/alloc/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
//! The [`alloc`](alloc/index.html) module defines the low-level interface to the
5151
//! default global allocator. It is not compatible with the libc allocator API.
5252
//!
53-
//! [`Arc`]: sync/index.html
54-
//! [`Box`]: boxed/index.html
55-
//! [`Cell`]: ../core/cell/index.html
56-
//! [`Rc`]: rc/index.html
57-
//! [`RefCell`]: ../core/cell/index.html
53+
//! [`Arc`]: sync
54+
//! [`Box`]: boxed
55+
//! [`Cell`]: core::cell
56+
//! [`Rc`]: rc
57+
//! [`RefCell`]: core::cell
5858
5959
#![allow(unused_attributes)]
6060
#![stable(feature = "alloc", since = "1.36.0")]

library/alloc/src/macros.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
/// to the same boxed integer value, not five references pointing to independently
3030
/// boxed integers.
3131
///
32-
/// [`Vec`]: ../std/vec/struct.Vec.html
33-
/// [`Clone`]: ../std/clone/trait.Clone.html
32+
/// [`Vec`]: crate::vec::Vec
3433
#[cfg(not(test))]
3534
#[macro_export]
3635
#[stable(feature = "rust1", since = "1.0.0")]
@@ -81,11 +80,11 @@ macro_rules! vec {
8180
/// To convert a single value to a string, use the [`to_string`] method. This
8281
/// will use the [`Display`] formatting trait.
8382
///
84-
/// [fmt]: ../std/fmt/index.html
83+
/// [fmt]: core::fmt
8584
/// [`print!`]: ../std/macro.print.html
86-
/// [`write!`]: ../std/macro.write.html
87-
/// [`to_string`]: ../std/string/trait.ToString.html
88-
/// [`Display`]: ../std/fmt/trait.Display.html
85+
/// [`write!`]: core::write
86+
/// [`to_string`]: crate::string::ToString
87+
/// [`Display`]: core::fmt::Display
8988
///
9089
/// # Panics
9190
///

0 commit comments

Comments
 (0)