Skip to content

Commit 13dfa9c

Browse files
authored
Rollup merge of #75787 - LeSeulArtichaut:core-intra-doc, r=jyn514
Use intra-doc-links in `core::ops::*` Helps with #75080. r? @jyn514
2 parents 2ea6379 + 9424ac7 commit 13dfa9c

File tree

7 files changed

+18
-47
lines changed

7 files changed

+18
-47
lines changed

library/core/src/ops/deref.rs

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
/// [method resolution] and [type coercions].
2929
///
3030
/// [book]: ../../book/ch15-02-deref.html
31-
/// [`DerefMut`]: trait.DerefMut.html
3231
/// [more]: #more-on-deref-coercion
3332
/// [ref-deref-op]: ../../reference/expressions/operator-expr.html#the-dereference-operator
3433
/// [method resolution]: ../../reference/expressions/method-call-expr.html
@@ -125,7 +124,6 @@ impl<T: ?Sized> Deref for &mut T {
125124
/// [method resolution] and [type coercions].
126125
///
127126
/// [book]: ../../book/ch15-02-deref.html
128-
/// [`Deref`]: trait.Deref.html
129127
/// [more]: #more-on-deref-coercion
130128
/// [ref-deref-op]: ../../reference/expressions/operator-expr.html#the-dereference-operator
131129
/// [method resolution]: ../../reference/expressions/method-call-expr.html

library/core/src/ops/drop.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@
7878
///
7979
/// In other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.
8080
///
81-
/// If you'd like explicitly call the destructor of a value, [`std::mem::drop`] can be used instead.
81+
/// If you'd like explicitly call the destructor of a value, [`mem::drop`] can be used instead.
8282
///
83-
/// [`std::mem::drop`]: ../../std/mem/fn.drop.html
83+
/// [`mem::drop`]: drop
8484
///
8585
/// ## Drop order
8686
///
@@ -132,16 +132,14 @@
132132
/// are `Copy` get implicitly duplicated by the compiler, making it very
133133
/// hard to predict when, and how often destructors will be executed. As such,
134134
/// these types cannot have destructors.
135-
///
136-
/// [`Copy`]: ../../std/marker/trait.Copy.html
137135
#[lang = "drop"]
138136
#[stable(feature = "rust1", since = "1.0.0")]
139137
pub trait Drop {
140138
/// Executes the destructor for this type.
141139
///
142140
/// This method is called implicitly when the value goes out of scope,
143141
/// and cannot be called explicitly (this is compiler error [E0040]).
144-
/// However, the [`std::mem::drop`] function in the prelude can be
142+
/// However, the [`mem::drop`] function in the prelude can be
145143
/// used to call the argument's `Drop` implementation.
146144
///
147145
/// When this method has been called, `self` has not yet been deallocated.
@@ -156,12 +154,12 @@ pub trait Drop {
156154
/// Note that even if this panics, the value is considered to be dropped;
157155
/// you must not cause `drop` to be called again. This is normally automatically
158156
/// handled by the compiler, but when using unsafe code, can sometimes occur
159-
/// unintentionally, particularly when using [`std::ptr::drop_in_place`].
157+
/// unintentionally, particularly when using [`ptr::drop_in_place`].
160158
///
161159
/// [E0040]: ../../error-index.html#E0040
162-
/// [`panic!`]: ../macro.panic.html
163-
/// [`std::mem::drop`]: ../../std/mem/fn.drop.html
164-
/// [`std::ptr::drop_in_place`]: ../../std/ptr/fn.drop_in_place.html
160+
/// [`panic!`]: crate::panic!
161+
/// [`mem::drop`]: drop
162+
/// [`ptr::drop_in_place`]: crate::ptr::drop_in_place
165163
#[stable(feature = "rust1", since = "1.0.0")]
166164
fn drop(&mut self);
167165
}

library/core/src/ops/function.rs

-6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
/// this can refer to [the relevant section in the *Rustonomicon*][nomicon].
2929
///
3030
/// [book]: ../../book/ch13-01-closures.html
31-
/// [`FnMut`]: trait.FnMut.html
32-
/// [`FnOnce`]: trait.FnOnce.html
3331
/// [function pointers]: ../../std/primitive.fn.html
3432
/// [nomicon]: ../../nomicon/hrtb.html
3533
///
@@ -99,8 +97,6 @@ pub trait Fn<Args>: FnMut<Args> {
9997
/// this can refer to [the relevant section in the *Rustonomicon*][nomicon].
10098
///
10199
/// [book]: ../../book/ch13-01-closures.html
102-
/// [`Fn`]: trait.Fn.html
103-
/// [`FnOnce`]: trait.FnOnce.html
104100
/// [function pointers]: ../../std/primitive.fn.html
105101
/// [nomicon]: ../../nomicon/hrtb.html
106102
///
@@ -180,8 +176,6 @@ pub trait FnMut<Args>: FnOnce<Args> {
180176
/// this can refer to [the relevant section in the *Rustonomicon*][nomicon].
181177
///
182178
/// [book]: ../../book/ch13-01-closures.html
183-
/// [`Fn`]: trait.Fn.html
184-
/// [`FnMut`]: trait.FnMut.html
185179
/// [function pointers]: ../../std/primitive.fn.html
186180
/// [nomicon]: ../../nomicon/hrtb.html
187181
///

library/core/src/ops/index.rs

-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
/// [`IndexMut`] is used instead. This allows nice things such as
66
/// `let value = v[index]` if the type of `value` implements [`Copy`].
77
///
8-
/// [`IndexMut`]: ../../std/ops/trait.IndexMut.html
9-
/// [`Copy`]: ../../std/marker/trait.Copy.html
10-
///
118
/// # Examples
129
///
1310
/// The following example implements `Index` on a read-only `NucleotideCount`
@@ -76,8 +73,6 @@ pub trait Index<Idx: ?Sized> {
7673
/// an immutable value is requested, the [`Index`] trait is used instead. This
7774
/// allows nice things such as `v[index] = value`.
7875
///
79-
/// [`Index`]: ../../std/ops/trait.Index.html
80-
///
8176
/// # Examples
8277
///
8378
/// A very simple implementation of a `Balance` struct that has two sides, where

library/core/src/ops/mod.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,7 @@
133133
//! // `consume_and_return_x` can no longer be invoked at this point
134134
//! ```
135135
//!
136-
//! [`Fn`]: trait.Fn.html
137-
//! [`FnMut`]: trait.FnMut.html
138-
//! [`FnOnce`]: trait.FnOnce.html
139-
//! [`Add`]: trait.Add.html
140-
//! [`Sub`]: trait.Sub.html
141-
//! [`Mul`]: trait.Mul.html
142-
//! [`clone`]: ../clone/trait.Clone.html#tymethod.clone
136+
//! [`clone`]: Clone::clone
143137
//! [operator precedence]: ../../reference/expressions.html#expression-precedence
144138
145139
#![stable(feature = "rust1", since = "1.0.0")]

library/core/src/ops/range.rs

+9-17
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ use crate::hash::Hash;
3535
/// assert_eq!(arr[1..=3], [ 1,2,3 ]);
3636
/// ```
3737
///
38-
/// [`IntoIterator`]: ../iter/trait.Iterator.html
39-
/// [`Iterator`]: ../iter/trait.IntoIterator.html
40-
/// [slicing index]: ../slice/trait.SliceIndex.html
38+
/// [slicing index]: crate::slice::SliceIndex
4139
#[cfg_attr(not(bootstrap), lang = "RangeFull")]
4240
#[doc(alias = "..")]
4341
#[derive(Copy, Clone, Default, PartialEq, Eq, Hash)]
@@ -178,8 +176,6 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
178176
/// assert_eq!(arr[1.. 3], [ 1,2 ]);
179177
/// assert_eq!(arr[1..=3], [ 1,2,3 ]);
180178
/// ```
181-
///
182-
/// [`Iterator`]: ../iter/trait.IntoIterator.html
183179
#[cfg_attr(not(bootstrap), lang = "RangeFrom")]
184180
#[doc(alias = "..")]
185181
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
@@ -260,9 +256,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
260256
/// assert_eq!(arr[1..=3], [ 1,2,3 ]);
261257
/// ```
262258
///
263-
/// [`IntoIterator`]: ../iter/trait.Iterator.html
264-
/// [`Iterator`]: ../iter/trait.IntoIterator.html
265-
/// [slicing index]: ../slice/trait.SliceIndex.html
259+
/// [slicing index]: crate::slice::SliceIndex
266260
#[cfg_attr(not(bootstrap), lang = "RangeTo")]
267261
#[doc(alias = "..")]
268262
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
@@ -315,8 +309,8 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
315309
/// iteration has finished are **unspecified** other than that [`.is_empty()`]
316310
/// will return `true` once no more values will be produced.
317311
///
318-
/// [fused]: ../iter/trait.FusedIterator.html
319-
/// [`.is_empty()`]: #method.is_empty
312+
/// [fused]: crate::iter::FusedIterator
313+
/// [`.is_empty()`]: RangeInclusive::is_empty
320314
///
321315
/// # Examples
322316
///
@@ -383,8 +377,8 @@ impl<Idx> RangeInclusive<Idx> {
383377
/// Note: the value returned by this method is unspecified after the range
384378
/// has been iterated to exhaustion.
385379
///
386-
/// [`end()`]: #method.end
387-
/// [`is_empty()`]: #method.is_empty
380+
/// [`end()`]: RangeInclusive::end
381+
/// [`is_empty()`]: RangeInclusive::is_empty
388382
///
389383
/// # Examples
390384
///
@@ -408,8 +402,8 @@ impl<Idx> RangeInclusive<Idx> {
408402
/// Note: the value returned by this method is unspecified after the range
409403
/// has been iterated to exhaustion.
410404
///
411-
/// [`start()`]: #method.start
412-
/// [`is_empty()`]: #method.is_empty
405+
/// [`start()`]: RangeInclusive::start
406+
/// [`is_empty()`]: RangeInclusive::is_empty
413407
///
414408
/// # Examples
415409
///
@@ -558,9 +552,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
558552
/// assert_eq!(arr[1..=3], [ 1,2,3 ]);
559553
/// ```
560554
///
561-
/// [`IntoIterator`]: ../iter/trait.Iterator.html
562-
/// [`Iterator`]: ../iter/trait.IntoIterator.html
563-
/// [slicing index]: ../slice/trait.SliceIndex.html
555+
/// [slicing index]: crate::slice::SliceIndex
564556
#[cfg_attr(not(bootstrap), lang = "RangeToInclusive")]
565557
#[doc(alias = "..=")]
566558
#[derive(Copy, Clone, PartialEq, Eq, Hash)]

library/core/src/ops/unsize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::marker::Unsize;
2929
/// pointers. It is implemented automatically by the compiler.
3030
///
3131
/// [dst-coerce]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
32-
/// [unsize]: ../marker/trait.Unsize.html
32+
/// [unsize]: crate::marker::Unsize
3333
/// [nomicon-coerce]: ../../nomicon/coercions.html
3434
#[unstable(feature = "coerce_unsized", issue = "27732")]
3535
#[lang = "coerce_unsized"]

0 commit comments

Comments
 (0)