Add regression tests for #108653
This commit is contained in:
parent
e193950c3c
commit
c78ebab258
@ -18,84 +18,84 @@ help: to link to the builtin type, prefix with `prim@`
|
||||
LL | /// [prim@true]
|
||||
| +++++
|
||||
|
||||
error: `ambiguous` is both a struct and a function
|
||||
error: `ambiguous` is both a function and a struct
|
||||
--> $DIR/ambiguity.rs:27:7
|
||||
|
|
||||
LL | /// [`ambiguous`] is ambiguous.
|
||||
| ^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the struct, prefix with `struct@`
|
||||
|
|
||||
LL | /// [`struct@ambiguous`] is ambiguous.
|
||||
| +++++++
|
||||
help: to link to the function, add parentheses
|
||||
|
|
||||
LL | /// [`ambiguous()`] is ambiguous.
|
||||
| ++
|
||||
help: to link to the struct, prefix with `struct@`
|
||||
|
|
||||
LL | /// [`struct@ambiguous`] is ambiguous.
|
||||
| +++++++
|
||||
|
||||
error: `ambiguous` is both a struct and a function
|
||||
error: `ambiguous` is both a function and a struct
|
||||
--> $DIR/ambiguity.rs:29:6
|
||||
|
|
||||
LL | /// [ambiguous] is ambiguous.
|
||||
| ^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the struct, prefix with `struct@`
|
||||
|
|
||||
LL | /// [struct@ambiguous] is ambiguous.
|
||||
| +++++++
|
||||
help: to link to the function, add parentheses
|
||||
|
|
||||
LL | /// [ambiguous()] is ambiguous.
|
||||
| ++
|
||||
help: to link to the struct, prefix with `struct@`
|
||||
|
|
||||
LL | /// [struct@ambiguous] is ambiguous.
|
||||
| +++++++
|
||||
|
||||
error: `multi_conflict` is a struct, a function, and a macro
|
||||
error: `multi_conflict` is a function, a struct, and a macro
|
||||
--> $DIR/ambiguity.rs:31:7
|
||||
|
|
||||
LL | /// [`multi_conflict`] is a three-way conflict.
|
||||
| ^^^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the struct, prefix with `struct@`
|
||||
|
|
||||
LL | /// [`struct@multi_conflict`] is a three-way conflict.
|
||||
| +++++++
|
||||
help: to link to the function, add parentheses
|
||||
|
|
||||
LL | /// [`multi_conflict()`] is a three-way conflict.
|
||||
| ++
|
||||
help: to link to the struct, prefix with `struct@`
|
||||
|
|
||||
LL | /// [`struct@multi_conflict`] is a three-way conflict.
|
||||
| +++++++
|
||||
help: to link to the macro, add an exclamation mark
|
||||
|
|
||||
LL | /// [`multi_conflict!`] is a three-way conflict.
|
||||
| +
|
||||
|
||||
error: `type_and_value` is both a module and a constant
|
||||
error: `type_and_value` is both a constant and a module
|
||||
--> $DIR/ambiguity.rs:33:16
|
||||
|
|
||||
LL | /// Ambiguous [type_and_value].
|
||||
| ^^^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the module, prefix with `mod@`
|
||||
|
|
||||
LL | /// Ambiguous [mod@type_and_value].
|
||||
| ++++
|
||||
help: to link to the constant, prefix with `const@`
|
||||
|
|
||||
LL | /// Ambiguous [const@type_and_value].
|
||||
| ++++++
|
||||
help: to link to the module, prefix with `mod@`
|
||||
|
|
||||
LL | /// Ambiguous [mod@type_and_value].
|
||||
| ++++
|
||||
|
||||
error: `foo::bar` is both an enum and a function
|
||||
error: `foo::bar` is both a function and an enum
|
||||
--> $DIR/ambiguity.rs:35:43
|
||||
|
|
||||
LL | /// Ambiguous non-implied shortcut link [`foo::bar`].
|
||||
| ^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the enum, prefix with `enum@`
|
||||
|
|
||||
LL | /// Ambiguous non-implied shortcut link [`enum@foo::bar`].
|
||||
| +++++
|
||||
help: to link to the function, add parentheses
|
||||
|
|
||||
LL | /// Ambiguous non-implied shortcut link [`foo::bar()`].
|
||||
| ++
|
||||
help: to link to the enum, prefix with `enum@`
|
||||
|
|
||||
LL | /// Ambiguous non-implied shortcut link [`enum@foo::bar`].
|
||||
| +++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
// This is ensuring that the UI output for associated items is as expected.
|
||||
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
/// [`Trait::IDENT`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
pub trait Trait {
|
||||
type IDENT;
|
||||
const IDENT: usize;
|
||||
}
|
||||
|
||||
/// [`Trait2::IDENT`]
|
||||
//~^ ERROR both an associated function and an associated type
|
||||
pub trait Trait2 {
|
||||
type IDENT;
|
||||
fn IDENT() {}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
error: `Trait::IDENT` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items-2.rs:5:7
|
||||
|
|
||||
LL | /// [`Trait::IDENT`]
|
||||
| ^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-2.rs:3:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@Trait::IDENT`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Trait::IDENT`]
|
||||
| +++++
|
||||
|
||||
error: `Trait2::IDENT` is both an associated function and an associated type
|
||||
--> $DIR/issue-108653-associated-items-2.rs:12:7
|
||||
|
|
||||
LL | /// [`Trait2::IDENT`]
|
||||
| ^^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the associated function, add parentheses
|
||||
|
|
||||
LL | /// [`Trait2::IDENT()`]
|
||||
| ++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Trait2::IDENT`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -0,0 +1,16 @@
|
||||
// This is ensuring that the UI output for associated items works when it's being documented
|
||||
// from another item.
|
||||
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![allow(nonstandard_style)]
|
||||
|
||||
pub trait Trait {
|
||||
type Trait;
|
||||
const Trait: usize;
|
||||
}
|
||||
|
||||
/// [`Trait`]
|
||||
//~^ ERROR both a constant and a trait
|
||||
/// [`Trait::Trait`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
pub const Trait: usize = 0;
|
@ -0,0 +1,37 @@
|
||||
error: `Trait` is both a constant and a trait
|
||||
--> $DIR/issue-108653-associated-items-3.rs:12:7
|
||||
|
|
||||
LL | /// [`Trait`]
|
||||
| ^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-3.rs:4:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@Trait`]
|
||||
| ++++++
|
||||
help: to link to the trait, prefix with `trait@`
|
||||
|
|
||||
LL | /// [`trait@Trait`]
|
||||
| ++++++
|
||||
|
||||
error: `Trait::Trait` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items-3.rs:14:7
|
||||
|
|
||||
LL | /// [`Trait::Trait`]
|
||||
| ^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@Trait::Trait`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Trait::Trait`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -0,0 +1,21 @@
|
||||
// This is ensuring that the UI output for associated items works when it's being documented
|
||||
// from another item.
|
||||
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![allow(nonstandard_style)]
|
||||
|
||||
pub trait Trait {
|
||||
type Trait;
|
||||
}
|
||||
|
||||
/// [`Struct::Trait`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
pub struct Struct;
|
||||
|
||||
impl Trait for Struct {
|
||||
type Trait = Struct;
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
pub const Trait: usize = 0;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
error: `Struct::Trait` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items-4.rs:11:7
|
||||
|
|
||||
LL | /// [`Struct::Trait`]
|
||||
| ^^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-4.rs:4:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@Struct::Trait`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Struct::Trait`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,8 @@
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![allow(nonstandard_style)]
|
||||
|
||||
/// [`u32::MAX`]
|
||||
//~^ ERROR both an associated constant and a trait
|
||||
pub mod u32 {
|
||||
pub trait MAX {}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
error: `u32::MAX` is both an associated constant and a trait
|
||||
--> $DIR/issue-108653-associated-items-5.rs:4:7
|
||||
|
|
||||
LL | /// [`u32::MAX`]
|
||||
| ^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-5.rs:1:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@u32::MAX`]
|
||||
| ++++++
|
||||
help: to link to the trait, prefix with `trait@`
|
||||
|
|
||||
LL | /// [`trait@u32::MAX`]
|
||||
| ++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,8 @@
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![allow(nonstandard_style)]
|
||||
|
||||
/// [`u32::MAX`]
|
||||
//~^ ERROR both an associated constant and a builtin type
|
||||
pub mod u32 {
|
||||
pub use std::primitive::u32 as MAX;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
error: `u32::MAX` is both an associated constant and a builtin type
|
||||
--> $DIR/issue-108653-associated-items-6.rs:4:7
|
||||
|
|
||||
LL | /// [`u32::MAX`]
|
||||
| ^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-6.rs:1:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@u32::MAX`]
|
||||
| ++++++
|
||||
help: to link to the builtin type, prefix with `prim@`
|
||||
|
|
||||
LL | /// [`prim@u32::MAX`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,12 @@
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![allow(nonstandard_style)]
|
||||
|
||||
pub trait Trait {
|
||||
type MAX;
|
||||
}
|
||||
|
||||
/// [`u32::MAX`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
impl Trait for u32 {
|
||||
type MAX = u32;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
error: `u32::MAX` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items-7.rs:8:7
|
||||
|
|
||||
LL | /// [`u32::MAX`]
|
||||
| ^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-7.rs:1:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@u32::MAX`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@u32::MAX`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,12 @@
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
#![allow(nonstandard_style)]
|
||||
|
||||
/// [`u32::MAX`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
pub trait T {
|
||||
type MAX;
|
||||
}
|
||||
|
||||
impl T for u32 {
|
||||
type MAX = ();
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
error: `u32::MAX` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items-8.rs:4:7
|
||||
|
|
||||
LL | /// [`u32::MAX`]
|
||||
| ^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items-8.rs:1:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@u32::MAX`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@u32::MAX`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,11 @@
|
||||
// check-pass
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
//! [usize::Item]
|
||||
|
||||
pub trait Foo { type Item; }
|
||||
pub trait Bar { type Item; }
|
||||
|
||||
impl Foo for usize { type Item = u32; }
|
||||
impl Bar for usize { type Item = i32; }
|
35
tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs
Normal file
35
tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// This is ensuring that the UI output for associated items is as expected.
|
||||
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
pub enum Enum {
|
||||
IDENT,
|
||||
}
|
||||
|
||||
/// [`Self::IDENT`]
|
||||
//~^ ERROR both an associated function and an associated type
|
||||
pub trait Trait {
|
||||
type IDENT;
|
||||
fn IDENT();
|
||||
}
|
||||
|
||||
/// [`Self::IDENT`]
|
||||
//~^ ERROR both an associated function and a variant
|
||||
impl Trait for Enum {
|
||||
type IDENT = usize;
|
||||
fn IDENT() {}
|
||||
}
|
||||
|
||||
/// [`Self::IDENT2`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
pub trait Trait2 {
|
||||
type IDENT2;
|
||||
const IDENT2: usize;
|
||||
}
|
||||
|
||||
/// [`Self::IDENT2`]
|
||||
//~^ ERROR both an associated constant and an associated type
|
||||
impl Trait2 for Enum {
|
||||
type IDENT2 = usize;
|
||||
const IDENT2: usize = 0;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
error: `Self::IDENT` is both an associated function and an associated type
|
||||
--> $DIR/issue-108653-associated-items.rs:9:7
|
||||
|
|
||||
LL | /// [`Self::IDENT`]
|
||||
| ^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-108653-associated-items.rs:3:9
|
||||
|
|
||||
LL | #![deny(rustdoc::broken_intra_doc_links)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: to link to the associated function, add parentheses
|
||||
|
|
||||
LL | /// [`Self::IDENT()`]
|
||||
| ++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Self::IDENT`]
|
||||
| +++++
|
||||
|
||||
error: `Self::IDENT2` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items.rs:23:7
|
||||
|
|
||||
LL | /// [`Self::IDENT2`]
|
||||
| ^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@Self::IDENT2`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Self::IDENT2`]
|
||||
| +++++
|
||||
|
||||
error: `Self::IDENT2` is both an associated constant and an associated type
|
||||
--> $DIR/issue-108653-associated-items.rs:30:7
|
||||
|
|
||||
LL | /// [`Self::IDENT2`]
|
||||
| ^^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the associated constant, prefix with `const@`
|
||||
|
|
||||
LL | /// [`const@Self::IDENT2`]
|
||||
| ++++++
|
||||
help: to link to the associated type, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Self::IDENT2`]
|
||||
| +++++
|
||||
|
||||
error: `Self::IDENT` is both an associated function and a variant
|
||||
--> $DIR/issue-108653-associated-items.rs:16:7
|
||||
|
|
||||
LL | /// [`Self::IDENT`]
|
||||
| ^^^^^^^^^^^ ambiguous link
|
||||
|
|
||||
help: to link to the associated function, add parentheses
|
||||
|
|
||||
LL | /// [`Self::IDENT()`]
|
||||
| ++
|
||||
help: to link to the variant, prefix with `type@`
|
||||
|
|
||||
LL | /// [`type@Self::IDENT`]
|
||||
| +++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user