Skip to content
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

Remove intra-doc link disambiguation prefix aliases #77277

Closed
Show file tree
Hide file tree
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
Expand Up @@ -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)]
Expand All @@ -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
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -1569,7 +1569,7 @@ impl String {
///
/// This will drop any excess capacity.
///
/// [`str`]: prim@str
/// [`str`]: primitive@str
///
/// # Examples
///
Expand Down Expand Up @@ -1639,7 +1639,7 @@ impl FromUtf8Error {
/// on using it.
///
/// [`std::str`]: core::str
/// [`&str`]: prim@str
/// [`&str`]: primitive@str
///
/// # Examples
///
Expand Down
56 changes: 28 additions & 28 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -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̆";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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
///
Expand Down
8 changes: 4 additions & 4 deletions library/std/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {}
Expand Down
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
Expand Up @@ -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)
Expand Down
Loading