Skip to content

Commit f83651a

Browse files
authored
Rollup merge of rust-lang#77971 - jyn514:broken-intra-doc-links, r=mark-simulacrum
Deny broken intra-doc links in linkchecker Since rustdoc isn't warning about these links, check for them manually. This also fixes the broken links that popped up from the lint.
2 parents 617b87f + b221819 commit f83651a

File tree

17 files changed

+92
-20
lines changed

17 files changed

+92
-20
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,10 @@ dependencies = [
17441744
[[package]]
17451745
name = "linkchecker"
17461746
version = "0.1.0"
1747+
dependencies = [
1748+
"once_cell",
1749+
"regex",
1750+
]
17471751

17481752
[[package]]
17491753
name = "linked-hash-map"

compiler/rustc_error_codes/src/error_codes/E0660.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ llvm_asm!("nop" "nop");
99
Considering that this would be a long explanation, we instead recommend you
1010
take a look at the [`llvm_asm`] chapter of the Unstable book:
1111

12-
[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
12+
[`llvm_asm`]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html

compiler/rustc_error_codes/src/error_codes/E0661.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ llvm_asm!("nop" : "r"(a));
1010
Considering that this would be a long explanation, we instead recommend you
1111
take a look at the [`llvm_asm`] chapter of the Unstable book:
1212

13-
[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
13+
[`llvm_asm`]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html

compiler/rustc_error_codes/src/error_codes/E0662.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ llvm_asm!("xor %eax, %eax"
1313
Considering that this would be a long explanation, we instead recommend you
1414
take a look at the [`llvm_asm`] chapter of the Unstable book:
1515

16-
[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
16+
[`llvm_asm`]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html

compiler/rustc_error_codes/src/error_codes/E0663.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ llvm_asm!("xor %eax, %eax"
1313
Considering that this would be a long explanation, we instead recommend you
1414
take a look at the [`llvm_asm`] chapter of the Unstable book:
1515

16-
[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
16+
[`llvm_asm`]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html

compiler/rustc_error_codes/src/error_codes/E0664.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ llvm_asm!("mov $$0x200, %eax"
1313
Considering that this would be a long explanation, we instead recommend you
1414
take a look at the [`llvm_asm`] chapter of the Unstable book:
1515

16-
[llvm_asm]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html
16+
[`llvm_asm`]: https://doc.rust-lang.org/stable/unstable-book/library-features/llvm-asm.html

library/core/src/alloc/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ impl fmt::Display for AllocError {
8989
pub unsafe trait AllocRef {
9090
/// Attempts to allocate a block of memory.
9191
///
92-
/// On success, returns a [`NonNull<[u8]>`] meeting the size and alignment guarantees of `layout`.
92+
/// On success, returns a [`NonNull<[u8]>`][NonNull] meeting the size and alignment guarantees of `layout`.
9393
///
9494
/// The returned block may have a larger size than specified by `layout.size()`, and may or may
9595
/// not have its contents initialized.
9696
///
97-
/// [`NonNull<[u8]>`]: NonNull
98-
///
9997
/// # Errors
10098
///
10199
/// Returning `Err` indicates that either memory is exhausted or `layout` does not meet
@@ -146,7 +144,7 @@ pub unsafe trait AllocRef {
146144

147145
/// Attempts to extend the memory block.
148146
///
149-
/// Returns a new [`NonNull<[u8]>`] containing a pointer and the actual size of the allocated
147+
/// Returns a new [`NonNull<[u8]>`][NonNull] containing a pointer and the actual size of the allocated
150148
/// memory. The pointer is suitable for holding data described by `new_layout`. To accomplish
151149
/// this, the allocator may extend the allocation referenced by `ptr` to fit the new layout.
152150
///
@@ -158,8 +156,6 @@ pub unsafe trait AllocRef {
158156
/// If this method returns `Err`, then ownership of the memory block has not been transferred to
159157
/// this allocator, and the contents of the memory block are unaltered.
160158
///
161-
/// [`NonNull<[u8]>`]: NonNull
162-
///
163159
/// # Safety
164160
///
165161
/// * `ptr` must denote a block of memory [*currently allocated*] via this allocator.
@@ -271,7 +267,7 @@ pub unsafe trait AllocRef {
271267

272268
/// Attempts to shrink the memory block.
273269
///
274-
/// Returns a new [`NonNull<[u8]>`] containing a pointer and the actual size of the allocated
270+
/// Returns a new [`NonNull<[u8]>`][NonNull] containing a pointer and the actual size of the allocated
275271
/// memory. The pointer is suitable for holding data described by `new_layout`. To accomplish
276272
/// this, the allocator may shrink the allocation referenced by `ptr` to fit the new layout.
277273
///
@@ -283,8 +279,6 @@ pub unsafe trait AllocRef {
283279
/// If this method returns `Err`, then ownership of the memory block has not been transferred to
284280
/// this allocator, and the contents of the memory block are unaltered.
285281
///
286-
/// [`NonNull<[u8]>`]: NonNull
287-
///
288282
/// # Safety
289283
///
290284
/// * `ptr` must denote a block of memory [*currently allocated*] via this allocator.

library/core/src/convert/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ pub const fn identity<T>(x: T) -> T {
134134
/// want to accept all references that can be converted to [`&str`] as an argument.
135135
/// Since both [`String`] and [`&str`] implement `AsRef<str>` we can accept both as input argument.
136136
///
137+
/// [`&str`]: primitive@str
137138
/// [`Option<T>`]: Option
138139
/// [`Result<T, E>`]: Result
139140
/// [`Borrow`]: crate::borrow::Borrow

library/core/src/iter/traits/double_ended.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ pub trait DoubleEndedIterator: Iterator {
122122
/// assert_eq!(iter.advance_back_by(0), Ok(()));
123123
/// assert_eq!(iter.advance_back_by(100), Err(1)); // only `&3` was skipped
124124
/// ```
125+
///
126+
/// [`Ok(())`]: Ok
127+
/// [`Err(k)`]: Err
125128
#[inline]
126129
#[unstable(feature = "iter_advance_by", reason = "recently added", issue = "77404")]
127130
fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {

library/core/src/iter/traits/iterator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ pub trait Iterator {
289289
/// This method will eagerly skip `n` elements by calling [`next`] up to `n`
290290
/// times until [`None`] is encountered.
291291
///
292-
/// `advance_by(n)` will return [`Ok(())`] if the iterator successfully advances by
293-
/// `n` elements, or [`Err(k)`] if [`None`] is encountered, where `k` is the number
292+
/// `advance_by(n)` will return [`Ok(())`][Ok] if the iterator successfully advances by
293+
/// `n` elements, or [`Err(k)`][Err] if [`None`] is encountered, where `k` is the number
294294
/// of elements the iterator is advanced by before running out of elements (i.e. the
295295
/// length of the iterator). Note that `k` is always less than `n`.
296296
///
297-
/// Calling `advance_by(0)` does not consume any elements and always returns [`Ok(())`].
297+
/// Calling `advance_by(0)` does not consume any elements and always returns [`Ok(())`][Ok].
298298
///
299299
/// [`next`]: Iterator::next
300300
///

0 commit comments

Comments
 (0)