Skip to content

Commit 1ababd8

Browse files
Use intra-doc-links in alloc
1 parent 443e177 commit 1ababd8

File tree

10 files changed

+121
-220
lines changed

10 files changed

+121
-220
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-7
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

@@ -53,8 +53,7 @@ struct Node<T> {
5353
/// This `struct` is created by the [`iter`] method on [`LinkedList`]. See its
5454
/// documentation for more.
5555
///
56-
/// [`iter`]: struct.LinkedList.html#method.iter
57-
/// [`LinkedList`]: struct.LinkedList.html
56+
/// [`iter`]: LinkedList::iter
5857
#[stable(feature = "rust1", since = "1.0.0")]
5958
pub struct Iter<'a, T: 'a> {
6059
head: Option<NonNull<Node<T>>>,
@@ -83,8 +82,7 @@ impl<T> Clone for Iter<'_, T> {
8382
/// This `struct` is created by the [`iter_mut`] method on [`LinkedList`]. See its
8483
/// documentation for more.
8584
///
86-
/// [`iter_mut`]: struct.LinkedList.html#method.iter_mut
87-
/// [`LinkedList`]: struct.LinkedList.html
85+
/// [`iter_mut`]: LinkedList::iter_mut
8886
#[stable(feature = "rust1", since = "1.0.0")]
8987
pub struct IterMut<'a, T: 'a> {
9088
// We do *not* exclusively own the entire list here, references to node's `element`
@@ -109,7 +107,6 @@ impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
109107
/// (provided by the `IntoIterator` trait). See its documentation for more.
110108
///
111109
/// [`into_iter`]: struct.LinkedList.html#method.into_iter
112-
/// [`LinkedList`]: struct.LinkedList.html
113110
#[derive(Clone)]
114111
#[stable(feature = "rust1", since = "1.0.0")]
115112
pub struct IntoIter<T> {

library/alloc/src/fmt.rs

+16-22
Original file line numberDiff line numberDiff line change
@@ -501,31 +501,26 @@
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+
//! [`usize`]: core::usize
505+
//! [`isize`]: core::isize
506+
//! [`i8`]: core::i8
507+
//! [`fmt::Result`]: Result
508+
//! [`Result`]: core::result::Result
509+
//! [`std::fmt::Error`]: Error
510+
//! [`write!`]: core::write
511+
//! [`write`]: core::write
512+
//! [`format!`]: crate::format
513+
//! [`to_string`]: crate::string::ToString
514+
//! [`writeln!`]: core::writeln
518515
//! [`write_fmt`]: ../../std/io/trait.Write.html#method.write_fmt
519516
//! [`std::io::Write`]: ../../std/io/trait.Write.html
520517
//! [`print!`]: ../../std/macro.print.html
521518
//! [`println!`]: ../../std/macro.println.html
522519
//! [`eprint!`]: ../../std/macro.eprint.html
523520
//! [`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
521+
//! [`format_args!`]: core::format_args
522+
//! [`fmt::Arguments`]: Arguments
523+
//! [`format`]: crate::format
529524
530525
#![stable(feature = "rust1", since = "1.0.0")]
531526

@@ -576,9 +571,8 @@ use crate::string;
576571
/// assert_eq!(s, "Hello, world!");
577572
/// ```
578573
///
579-
/// [`Arguments`]: struct.Arguments.html
580-
/// [`format_args!`]: ../../std/macro.format_args.html
581-
/// [`format!`]: ../../std/macro.format.html
574+
/// [`format_args!`]: core::format_args
575+
/// [`format!`]: crate::format
582576
#[stable(feature = "rust1", since = "1.0.0")]
583577
pub fn format(args: Arguments<'_>) -> string::String {
584578
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)