summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/intra-doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/rustdoc-ui/intra-doc
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-ui/intra-doc')
-rw-r--r--tests/rustdoc-ui/intra-doc/ambiguity.rs2
-rw-r--r--tests/rustdoc-ui/intra-doc/ambiguity.stderr54
-rw-r--r--tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-doc.rs1
-rw-r--r--tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs3
-rw-r--r--tests/rustdoc-ui/intra-doc/errors.rs4
-rw-r--r--tests/rustdoc-ui/intra-doc/errors.stderr4
-rw-r--r--tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs10
-rw-r--r--tests/rustdoc-ui/intra-doc/inline-external-enum.rs8
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs22
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.rs17
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.stderr37
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.rs16
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.stderr37
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.rs21
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.stderr22
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.rs8
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.stderr22
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.rs8
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.stderr22
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.rs12
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.stderr22
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.rs12
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.stderr22
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs11
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs35
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-108653-associated-items.stderr67
-rw-r--r--tests/rustdoc-ui/intra-doc/non-path-primitives.stderr8
-rw-r--r--tests/rustdoc-ui/intra-doc/prim-conflict.rs10
-rw-r--r--tests/rustdoc-ui/intra-doc/prim-conflict.stderr12
-rw-r--r--tests/rustdoc-ui/intra-doc/reachable-non-exported.rs13
30 files changed, 495 insertions, 47 deletions
diff --git a/tests/rustdoc-ui/intra-doc/ambiguity.rs b/tests/rustdoc-ui/intra-doc/ambiguity.rs
index 1f3dc722e..0290b8582 100644
--- a/tests/rustdoc-ui/intra-doc/ambiguity.rs
+++ b/tests/rustdoc-ui/intra-doc/ambiguity.rs
@@ -35,6 +35,6 @@ pub mod foo {
/// Ambiguous non-implied shortcut link [`foo::bar`]. //~ERROR `foo::bar`
pub struct Docs {}
-/// [true] //~ ERROR `true` is both a module and a builtin type
+/// [true] //~ ERROR `true` is both a module and a primitive type
/// [primitive@true]
pub mod r#true {}
diff --git a/tests/rustdoc-ui/intra-doc/ambiguity.stderr b/tests/rustdoc-ui/intra-doc/ambiguity.stderr
index 7974796e4..47853e0b5 100644
--- a/tests/rustdoc-ui/intra-doc/ambiguity.stderr
+++ b/tests/rustdoc-ui/intra-doc/ambiguity.stderr
@@ -1,4 +1,4 @@
-error: `true` is both a module and a builtin type
+error: `true` is both a module and a primitive type
--> $DIR/ambiguity.rs:38:6
|
LL | /// [true]
@@ -13,89 +13,89 @@ help: to link to the module, prefix with `mod@`
|
LL | /// [mod@true]
| ++++
-help: to link to the builtin type, prefix with `prim@`
+help: to link to the primitive 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
diff --git a/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-doc.rs b/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-doc.rs
new file mode 100644
index 000000000..15bf51e6f
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-doc.rs
@@ -0,0 +1 @@
+//! Inner doc comment
diff --git a/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs b/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs
new file mode 100644
index 000000000..6c48f5aa0
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs
@@ -0,0 +1,3 @@
+pub enum O {
+ L = -1,
+}
diff --git a/tests/rustdoc-ui/intra-doc/errors.rs b/tests/rustdoc-ui/intra-doc/errors.rs
index 95dd2b98e..f37f49c24 100644
--- a/tests/rustdoc-ui/intra-doc/errors.rs
+++ b/tests/rustdoc-ui/intra-doc/errors.rs
@@ -54,11 +54,11 @@
/// [u8::not_found]
//~^ ERROR unresolved link
-//~| NOTE the builtin type `u8` has no associated item named `not_found`
+//~| NOTE the primitive type `u8` has no associated item named `not_found`
/// [std::primitive::u8::not_found]
//~^ ERROR unresolved link
-//~| NOTE the builtin type `u8` has no associated item named `not_found`
+//~| NOTE the primitive type `u8` has no associated item named `not_found`
/// [type@Vec::into_iter]
//~^ ERROR unresolved link
diff --git a/tests/rustdoc-ui/intra-doc/errors.stderr b/tests/rustdoc-ui/intra-doc/errors.stderr
index 1b2416d7d..a982bba00 100644
--- a/tests/rustdoc-ui/intra-doc/errors.stderr
+++ b/tests/rustdoc-ui/intra-doc/errors.stderr
@@ -80,13 +80,13 @@ error: unresolved link to `u8::not_found`
--> $DIR/errors.rs:55:6
|
LL | /// [u8::not_found]
- | ^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found`
+ | ^^^^^^^^^^^^^ the primitive type `u8` has no associated item named `not_found`
error: unresolved link to `std::primitive::u8::not_found`
--> $DIR/errors.rs:59:6
|
LL | /// [std::primitive::u8::not_found]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the primitive type `u8` has no associated item named `not_found`
error: unresolved link to `Vec::into_iter`
--> $DIR/errors.rs:63:6
diff --git a/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs b/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs
new file mode 100644
index 000000000..4d6a32566
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs
@@ -0,0 +1,10 @@
+// Test for issue #108501.
+// Module parent scope doesn't hijack import's parent scope for the import's doc links.
+
+// check-pass
+// aux-build: inner-crate-doc.rs
+// compile-flags: --extern inner_crate_doc --edition 2018
+
+/// Import doc comment [inner_crate_doc]
+#[doc(inline)]
+pub use inner_crate_doc;
diff --git a/tests/rustdoc-ui/intra-doc/inline-external-enum.rs b/tests/rustdoc-ui/intra-doc/inline-external-enum.rs
new file mode 100644
index 000000000..363dd7f64
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/inline-external-enum.rs
@@ -0,0 +1,8 @@
+// check-pass
+// aux-build: inner-crate-enum.rs
+// compile-flags:-Z unstable-options --output-format json
+
+#[doc(inline)]
+pub extern crate inner_crate_enum;
+
+fn main() {}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs
new file mode 100644
index 000000000..464c5f0d5
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs
@@ -0,0 +1,22 @@
+// This test ensures that this warning doesn't show up:
+// warning: `PartialEq` is both a trait and a derive macro
+// --> tests/rustdoc-ui/intra-doc/issue-108653-associated-items-10.rs:1:7
+// |
+// 1 | //! [`PartialEq`]
+// | ^^^^^^^^^ ambiguous link
+// |
+// = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
+// help: to link to the trait, prefix with `trait@`
+// |
+// 1 | //! [`trait@PartialEq`]
+// | ++++++
+// help: to link to the derive macro, prefix with `derive@`
+// |
+// 1 | //! [`derive@PartialEq`]
+// | +++++++
+
+// check-pass
+
+#![deny(rustdoc::broken_intra_doc_links)]
+
+//! [`PartialEq`]
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.rs
new file mode 100644
index 000000000..cbe60f746
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.rs
@@ -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() {}
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.stderr
new file mode 100644
index 000000000..952392548
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-2.stderr
@@ -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
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.rs
new file mode 100644
index 000000000..7ffd0a40e
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.rs
@@ -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;
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.stderr
new file mode 100644
index 000000000..6401dacb5
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-3.stderr
@@ -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
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.rs
new file mode 100644
index 000000000..537d61364
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.rs
@@ -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;
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.stderr
new file mode 100644
index 000000000..a8dc91204
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-4.stderr
@@ -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
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.rs
new file mode 100644
index 000000000..bc28bc544
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.rs
@@ -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 {}
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.stderr
new file mode 100644
index 000000000..7430044ac
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-5.stderr
@@ -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
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.rs
new file mode 100644
index 000000000..8fde74d0d
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.rs
@@ -0,0 +1,8 @@
+#![deny(rustdoc::broken_intra_doc_links)]
+#![allow(nonstandard_style)]
+
+/// [`u32::MAX`]
+//~^ ERROR both an associated constant and a primitive type
+pub mod u32 {
+ pub use std::primitive::u32 as MAX;
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.stderr
new file mode 100644
index 000000000..fe2d8cafa
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-6.stderr
@@ -0,0 +1,22 @@
+error: `u32::MAX` is both an associated constant and a primitive 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 primitive type, prefix with `prim@`
+ |
+LL | /// [`prim@u32::MAX`]
+ | +++++
+
+error: aborting due to previous error
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.rs
new file mode 100644
index 000000000..6e99f4365
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.rs
@@ -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;
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.stderr
new file mode 100644
index 000000000..1d302ff42
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-7.stderr
@@ -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
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.rs
new file mode 100644
index 000000000..2f8ee1566
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.rs
@@ -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 = ();
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.stderr
new file mode 100644
index 000000000..efed0e2ce
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-8.stderr
@@ -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
+
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs
new file mode 100644
index 000000000..3357ccf24
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items-9.rs
@@ -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; }
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs
new file mode 100644
index 000000000..0a393e26d
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items.rs
@@ -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;
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-108653-associated-items.stderr b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items.stderr
new file mode 100644
index 000000000..ed89fa839
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-108653-associated-items.stderr
@@ -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::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: `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: aborting due to 4 previous errors
+
diff --git a/tests/rustdoc-ui/intra-doc/non-path-primitives.stderr b/tests/rustdoc-ui/intra-doc/non-path-primitives.stderr
index 8ec894d10..6e08a9239 100644
--- a/tests/rustdoc-ui/intra-doc/non-path-primitives.stderr
+++ b/tests/rustdoc-ui/intra-doc/non-path-primitives.stderr
@@ -39,25 +39,25 @@ error: unresolved link to `unit::eq`
--> $DIR/non-path-primitives.rs:28:6
|
LL | //! [unit::eq]
- | ^^^^^^^^ the builtin type `unit` has no associated item named `eq`
+ | ^^^^^^^^ the primitive type `unit` has no associated item named `eq`
error: unresolved link to `tuple::eq`
--> $DIR/non-path-primitives.rs:29:6
|
LL | //! [tuple::eq]
- | ^^^^^^^^^ the builtin type `tuple` has no associated item named `eq`
+ | ^^^^^^^^^ the primitive type `tuple` has no associated item named `eq`
error: unresolved link to `fn::eq`
--> $DIR/non-path-primitives.rs:30:6
|
LL | //! [fn::eq]
- | ^^^^^^ the builtin type `fn` has no associated item named `eq`
+ | ^^^^^^ the primitive type `fn` has no associated item named `eq`
error: unresolved link to `reference::deref`
--> $DIR/non-path-primitives.rs:34:6
|
LL | //! [reference::deref]
- | ^^^^^^^^^^^^^^^^ the builtin type `reference` has no associated item named `deref`
+ | ^^^^^^^^^^^^^^^^ the primitive type `reference` has no associated item named `deref`
error: aborting due to 8 previous errors
diff --git a/tests/rustdoc-ui/intra-doc/prim-conflict.rs b/tests/rustdoc-ui/intra-doc/prim-conflict.rs
index 2c1a8b535..e87ce095c 100644
--- a/tests/rustdoc-ui/intra-doc/prim-conflict.rs
+++ b/tests/rustdoc-ui/intra-doc/prim-conflict.rs
@@ -2,16 +2,16 @@
//~^ NOTE lint level is defined
/// [char]
-//~^ ERROR both a module and a builtin type
+//~^ ERROR both a module and a primitive type
//~| NOTE ambiguous link
//~| HELP to link to the module
-//~| HELP to link to the builtin type
+//~| HELP to link to the primitive type
/// [type@char]
-//~^ ERROR both a module and a builtin type
+//~^ ERROR both a module and a primitive type
//~| NOTE ambiguous link
//~| HELP to link to the module
-//~| HELP to link to the builtin type
+//~| HELP to link to the primitive type
/// [mod@char] // ok
/// [prim@char] // ok
@@ -26,5 +26,5 @@ pub mod inner {
//! [struct@char]
//~^ ERROR incompatible link
//~| HELP prefix with `prim@`
- //~| NOTE resolved to a builtin type
+ //~| NOTE resolved to a primitive type
}
diff --git a/tests/rustdoc-ui/intra-doc/prim-conflict.stderr b/tests/rustdoc-ui/intra-doc/prim-conflict.stderr
index 6ef3b7eab..03ce8f15f 100644
--- a/tests/rustdoc-ui/intra-doc/prim-conflict.stderr
+++ b/tests/rustdoc-ui/intra-doc/prim-conflict.stderr
@@ -1,4 +1,4 @@
-error: `char` is both a module and a builtin type
+error: `char` is both a module and a primitive type
--> $DIR/prim-conflict.rs:4:6
|
LL | /// [char]
@@ -13,12 +13,12 @@ help: to link to the module, prefix with `mod@`
|
LL | /// [mod@char]
| ++++
-help: to link to the builtin type, prefix with `prim@`
+help: to link to the primitive type, prefix with `prim@`
|
LL | /// [prim@char]
| +++++
-error: `char` is both a module and a builtin type
+error: `char` is both a module and a primitive type
--> $DIR/prim-conflict.rs:10:6
|
LL | /// [type@char]
@@ -28,7 +28,7 @@ help: to link to the module, prefix with `mod@`
|
LL | /// [mod@char]
| ~~~~
-help: to link to the builtin type, prefix with `prim@`
+help: to link to the primitive type, prefix with `prim@`
|
LL | /// [prim@char]
| ~~~~~
@@ -48,9 +48,9 @@ error: incompatible link kind for `char`
--> $DIR/prim-conflict.rs:26:10
|
LL | //! [struct@char]
- | ^^^^^^^^^^^ this link resolved to a builtin type, which is not a struct
+ | ^^^^^^^^^^^ this link resolved to a primitive type, which is not a struct
|
-help: to link to the builtin type, prefix with `prim@`
+help: to link to the primitive type, prefix with `prim@`
|
LL | //! [prim@char]
| ~~~~~
diff --git a/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs b/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs
new file mode 100644
index 000000000..6afcad4f9
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/reachable-non-exported.rs
@@ -0,0 +1,13 @@
+// The structure is reachable, but not exported, so rustdoc
+// doesn't attempt to request doc link resolutions on it.
+
+// check-pass
+
+mod private {
+ /// [core::str::FromStr]
+ pub struct ReachableButNotExported;
+}
+
+pub fn foo() -> private::ReachableButNotExported {
+ private::ReachableButNotExported
+}