Auto merge of #75815 - jyn514:ambiguous-primitives, r=guillaumegomez
Report an ambiguity if both modules and primitives are in scope for intra-doc links Closes https://github.com/rust-lang/rust/issues/75381 - Add a new `prim@` disambiguator, since both modules and primitives are in the same namespace - Refactor `report_ambiguity` into a closure Additionally, I noticed that rustdoc would previously allow `[struct@char]` if `char` resolved to a primitive (not if it had a DefId). I fixed that and added a test case. I also need to update libstd to use `prim@char` instead of `type@char`. If possible I would also like to refactor `ambiguity_error` to use `Disambiguator` instead of its own hand-rolled match - that ran into issues with `prim@` (I updated one and not the other) and it would be better for them to be in sync.
This commit is contained in:
commit
aa7010df90
11 changed files with 253 additions and 70 deletions
|
@ -268,8 +268,8 @@ use crate::vec::Vec;
|
|||
///
|
||||
/// Here, there's no need to allocate more memory inside the loop.
|
||||
///
|
||||
/// [`str`]: type@str
|
||||
/// [`&str`]: type@str
|
||||
/// [`str`]: prim@str
|
||||
/// [`&str`]: prim@str
|
||||
/// [`Deref`]: core::ops::Deref
|
||||
/// [`as_str()`]: String::as_str
|
||||
#[derive(PartialOrd, Eq, Ord)]
|
||||
|
@ -296,7 +296,7 @@ pub struct String {
|
|||
///
|
||||
/// [`Utf8Error`]: core::str::Utf8Error
|
||||
/// [`std::str`]: core::str
|
||||
/// [`&str`]: str
|
||||
/// [`&str`]: prim@str
|
||||
/// [`utf8_error`]: Self::utf8_error
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -472,7 +472,7 @@ impl String {
|
|||
///
|
||||
/// [`from_utf8_unchecked`]: String::from_utf8_unchecked
|
||||
/// [`Vec<u8>`]: crate::vec::Vec
|
||||
/// [`&str`]: str
|
||||
/// [`&str`]: prim@str
|
||||
/// [`into_bytes`]: String::into_bytes
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
@ -1576,6 +1576,8 @@ impl String {
|
|||
///
|
||||
/// This will drop any excess capacity.
|
||||
///
|
||||
/// [`str`]: prim@str
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
|
@ -1644,7 +1646,7 @@ impl FromUtf8Error {
|
|||
/// on using it.
|
||||
///
|
||||
/// [`std::str`]: core::str
|
||||
/// [`&str`]: str
|
||||
/// [`&str`]: prim@str
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue