Skip to content

Remove intra-doc link disambiguation prefix aliases #77277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
@@ -269,8 +269,8 @@ use crate::vec::Vec;
///
/// Here, there's no need to allocate more memory inside the loop.
///
/// [`str`]: prim@str
/// [`&str`]: prim@str
/// [`str`]: primitive@str
/// [`&str`]: primitive@str
/// [`Deref`]: core::ops::Deref
/// [`as_str()`]: String::as_str
#[derive(PartialOrd, Eq, Ord)]
@@ -297,7 +297,7 @@ pub struct String {
///
/// [`Utf8Error`]: core::str::Utf8Error
/// [`std::str`]: core::str
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
/// [`utf8_error`]: Self::utf8_error
///
/// # Examples
@@ -473,7 +473,7 @@ impl String {
///
/// [`from_utf8_unchecked`]: String::from_utf8_unchecked
/// [`Vec<u8>`]: crate::vec::Vec
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
/// [`into_bytes`]: String::into_bytes
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1569,7 +1569,7 @@ impl String {
///
/// This will drop any excess capacity.
///
/// [`str`]: prim@str
/// [`str`]: primitive@str
///
/// # Examples
///
@@ -1639,7 +1639,7 @@ impl FromUtf8Error {
/// on using it.
///
/// [`std::str`]: core::str
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
///
/// # Examples
///
56 changes: 28 additions & 28 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
@@ -465,7 +465,7 @@ Section: Iterators
/// This struct is created by the [`chars`] method on [`str`].
/// See its documentation for more.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [`chars`]: str::chars
#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
@@ -663,7 +663,7 @@ impl<'a> Chars<'a> {
/// This struct is created by the [`char_indices`] method on [`str`].
/// See its documentation for more.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [`char_indices`]: str::char_indices
#[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
@@ -2261,7 +2261,7 @@ impl str {
/// This length is in bytes, not [`char`]s or graphemes. In other words,
/// it may not be what a human considers the length of the string.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
///
/// # Examples
///
@@ -2786,7 +2786,7 @@ impl str {
///
/// Remember, [`char`]s may not match your intuition about characters:
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
///
/// ```
/// let y = "y̆";
@@ -2839,7 +2839,7 @@ impl str {
///
/// Remember, [`char`]s may not match your intuition about characters:
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
///
/// ```
/// let yes = "y̆es";
@@ -3050,7 +3050,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -3077,7 +3077,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -3103,7 +3103,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -3132,7 +3132,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -3180,7 +3180,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -3227,7 +3227,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3347,7 +3347,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -3387,7 +3387,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3439,7 +3439,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// Equivalent to [`split`], except that the trailing substring
@@ -3484,7 +3484,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// Equivalent to [`split`], except that the trailing substring is
@@ -3533,7 +3533,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3586,7 +3586,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3675,7 +3675,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3712,7 +3712,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3754,7 +3754,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -3797,7 +3797,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Iterator behavior
@@ -4016,7 +4016,7 @@ impl str {
/// The [pattern] can be a [`char`], a slice of [`char`]s, or a function
/// or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -4064,7 +4064,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Text directionality
@@ -4109,7 +4109,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -4137,7 +4137,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Examples
@@ -4164,7 +4164,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Text directionality
@@ -4213,7 +4213,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Text directionality
@@ -4250,7 +4250,7 @@ impl str {
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [`char`]: primitive@char
/// [pattern]: self::pattern
///
/// # Text directionality
4 changes: 2 additions & 2 deletions library/std/src/error.rs
Original file line number Diff line number Diff line change
@@ -298,7 +298,7 @@ impl From<String> for Box<dyn Error> {
impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
/// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
///
/// [`str`]: prim@str
/// [`str`]: primitive@str
///
/// # Examples
///
@@ -321,7 +321,7 @@ impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
impl From<&str> for Box<dyn Error> {
/// Converts a [`str`] into a box of dyn [`Error`].
///
/// [`str`]: prim@str
/// [`str`]: primitive@str
///
/// # Examples
///
8 changes: 4 additions & 4 deletions library/std/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ use crate::sys;
/// extern functions. See the documentation for that function for a
/// discussion on ensuring the lifetime of the raw pointer.
///
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
/// [slice.as_ptr]: ../primitive.slice.html#method.as_ptr
/// [slice.len]: ../primitive.slice.html#method.len
/// [`Deref`]: ops::Deref
@@ -184,7 +184,7 @@ pub struct CString {
/// println!("string: {}", my_string_safe());
/// ```
///
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
#[derive(Hash)]
#[stable(feature = "rust1", since = "1.0.0")]
// FIXME:
@@ -1355,7 +1355,7 @@ impl CStr {
/// function will return the corresponding [`&str`] slice. Otherwise,
/// it will return an error with details of where UTF-8 validation failed.
///
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
///
/// # Examples
///
@@ -1383,7 +1383,7 @@ impl CStr {
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a
/// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result.
///
/// [`str`]: prim@str
/// [`str`]: primitive@str
/// [`Borrowed`]: Cow::Borrowed
/// [`Owned`]: Cow::Owned
/// [U+FFFD]: crate::char::REPLACEMENT_CHARACTER
2 changes: 1 addition & 1 deletion library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
@@ -482,7 +482,7 @@ where
/// ```
///
/// [`read()`]: Read::read
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
/// [`std::io`]: self
/// [`File`]: crate::fs::File
/// [slice]: ../../std/primitive.slice.html
2 changes: 1 addition & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@
//! [`Vec<T>`]: vec::Vec
//! [`atomic`]: sync::atomic
//! [`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
//! [`str`]: prim@str
//! [`str`]: primitive@str
//! [`mpsc`]: sync::mpsc
//! [`std::cmp`]: cmp
//! [`std::slice`]: slice
4 changes: 2 additions & 2 deletions library/std/src/primitive_docs.rs
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ mod prim_bool {}
/// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another
/// behaviour of the `!` type - expressions with type `!` will coerce into any other type.
///
/// [`u32`]: prim@u32
/// [`u32`]: primitive@u32
/// [`exit`]: process::exit
///
/// # `!` and generics
@@ -836,7 +836,7 @@ mod prim_f32 {}
///
/// *[See also the `std::f64::consts` module][`crate::f64::consts`].*
///
/// [`f32`]: prim@f32
/// [`f32`]: primitive@f32
/// [wikipedia]: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_f64 {}
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/linking-to-items-by-name.md
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ You can also link to sections using URL fragment specifiers:
struct MySpecialFormatter;
```

Paths in Rust have three namespaces: type, value, and macro. Items from these namespaces are allowed to overlap. In case of ambiguity, rustdoc will warn about the ambiguity and ask you to disambiguate, which can be done by using a prefix like `struct@`, `enum@`, `type@`, `trait@`, `union@`, `const@`, `static@`, `value@`, `function@`, `mod@`, `fn@`, `module@`, `method@`, `prim@`, `primitive@`, `macro@`, or `derive@`:
Paths in Rust have three namespaces: type, value, and macro. Items from these namespaces are allowed to overlap. In case of ambiguity, rustdoc will warn about the ambiguity and ask you to disambiguate, which can be done by using a prefix like `struct@`, `enum@`, `type@`, `trait@`, `union@`, `const@`, `static@`, `value@`, `mod@`, `fn@`, `method@`, `primitive@`, `macro@`, or `derive@`:

```rust
/// See also: [`Foo`](struct@Foo)
Loading