Skip to content

Commit

Permalink
docs: Escape brackets to satisfy the linkchecker
Browse files Browse the repository at this point in the history
My change to use `Type::def_id()` (formerly `Type::def_id_full()`) in
more places caused some docs to show up that used to be missed by
rustdoc. Those docs contained unescaped square brackets, which triggered
linkcheck errors. This commit escapes the square brackets and adds this
particular instance to the linkcheck exception list.
  • Loading branch information
camelid committed Oct 22, 2021
1 parent f93cf66 commit 865d99f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions library/core/src/str/traits.rs
Expand Up @@ -234,7 +234,7 @@ unsafe impl SliceIndex<str> for ops::Range<usize> {
/// Implements substring slicing with syntax `&self[.. end]` or `&mut
/// self[.. end]`.
///
/// Returns a slice of the given string from the byte range [`0`, `end`).
/// Returns a slice of the given string from the byte range \[0, `end`).
/// Equivalent to `&self[0 .. end]` or `&mut self[0 .. end]`.
///
/// This operation is *O*(1).
Expand Down Expand Up @@ -304,9 +304,8 @@ unsafe impl SliceIndex<str> for ops::RangeTo<usize> {
/// Implements substring slicing with syntax `&self[begin ..]` or `&mut
/// self[begin ..]`.
///
/// Returns a slice of the given string from the byte range [`begin`,
/// `len`). Equivalent to `&self[begin .. len]` or `&mut self[begin ..
/// len]`.
/// Returns a slice of the given string from the byte range \[`begin`, `len`).
/// Equivalent to `&self[begin .. len]` or `&mut self[begin .. len]`.
///
/// This operation is *O*(1).
///
Expand Down Expand Up @@ -433,7 +432,7 @@ unsafe impl SliceIndex<str> for ops::RangeInclusive<usize> {
/// Implements substring slicing with syntax `&self[..= end]` or `&mut
/// self[..= end]`.
///
/// Returns a slice of the given string from the byte range [0, `end`].
/// Returns a slice of the given string from the byte range \[0, `end`\].
/// Equivalent to `&self [0 .. end + 1]`, except if `end` has the maximum
/// value for `usize`.
///
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys_common/wtf8.rs
Expand Up @@ -686,7 +686,7 @@ impl Wtf8 {
}
}

/// Returns a slice of the given string for the byte range [`begin`..`end`).
/// Returns a slice of the given string for the byte range \[`begin`..`end`).
///
/// # Panics
///
Expand Down
2 changes: 2 additions & 0 deletions src/tools/linkchecker/main.rs
Expand Up @@ -85,6 +85,8 @@ const INTRA_DOC_LINK_EXCEPTIONS: &[(&str, &[&str])] = &[
("core/slice/trait.SliceIndex.html", &["begin</code>, <code>end"]),
("alloc/slice/trait.SliceIndex.html", &["begin</code>, <code>end"]),
("std/slice/trait.SliceIndex.html", &["begin</code>, <code>end"]),
("core/primitive.str.html", &["begin</code>, <code>end"]),
("std/primitive.str.html", &["begin</code>, <code>end"]),

];

Expand Down

0 comments on commit 865d99f

Please sign in to comment.