about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/intra-link-prim-conflict.rs30
-rw-r--r--src/test/rustdoc-ui/intra-link-prim-conflict.stderr53
2 files changed, 83 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/intra-link-prim-conflict.rs b/src/test/rustdoc-ui/intra-link-prim-conflict.rs
new file mode 100644
index 00000000000..34276fbcf20
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-link-prim-conflict.rs
@@ -0,0 +1,30 @@
+#![deny(broken_intra_doc_links)]
+//~^ NOTE lint level is defined
+
+/// [char]
+//~^ ERROR both a module and a builtin type
+//~| NOTE ambiguous link
+//~| HELP to link to the module
+//~| HELP to link to the builtin type
+
+/// [type@char]
+//~^ ERROR both a module and a builtin type
+//~| NOTE ambiguous link
+//~| HELP to link to the module
+//~| HELP to link to the builtin type
+
+/// [mod@char] // ok
+/// [prim@char] // ok
+
+/// [struct@char]
+//~^ ERROR incompatible link
+//~| HELP use its disambiguator
+//~| NOTE resolved to a module
+pub mod char {}
+
+pub mod inner {
+    //! [struct@char]
+    //~^ ERROR incompatible link
+    //~| HELP use its disambiguator
+    //~| NOTE resolved to a builtin type
+}
diff --git a/src/test/rustdoc-ui/intra-link-prim-conflict.stderr b/src/test/rustdoc-ui/intra-link-prim-conflict.stderr
new file mode 100644
index 00000000000..b28a4426666
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-link-prim-conflict.stderr
@@ -0,0 +1,53 @@
+error: `char` is both a module and a builtin type
+  --> $DIR/intra-link-prim-conflict.rs:4:6
+   |
+LL | /// [char]
+   |      ^^^^ ambiguous link
+   |
+note: the lint level is defined here
+  --> $DIR/intra-link-prim-conflict.rs:1:9
+   |
+LL | #![deny(broken_intra_doc_links)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+help: to link to the module, prefix with the item type
+   |
+LL | /// [module@char]
+   |      ^^^^^^^^^^^
+help: to link to the builtin type, prefix with the item type
+   |
+LL | /// [prim@char]
+   |      ^^^^^^^^^
+
+error: `char` is both a module and a builtin type
+  --> $DIR/intra-link-prim-conflict.rs:10:6
+   |
+LL | /// [type@char]
+   |      ^^^^^^^^^ ambiguous link
+   |
+help: to link to the module, prefix with the item type
+   |
+LL | /// [module@char]
+   |      ^^^^^^^^^^^
+help: to link to the builtin type, prefix with the item type
+   |
+LL | /// [prim@char]
+   |      ^^^^^^^^^
+
+error: incompatible link kind for `char`
+  --> $DIR/intra-link-prim-conflict.rs:19:6
+   |
+LL | /// [struct@char]
+   |      ^^^^^^^^^^^ help: to link to the module, use its disambiguator: `mod@char`
+   |
+   = note: this link resolved to a module, which is not a struct
+
+error: incompatible link kind for `char`
+  --> $DIR/intra-link-prim-conflict.rs:26:10
+   |
+LL |     //! [struct@char]
+   |          ^^^^^^^^^^^ help: to link to the builtin type, use its disambiguator: `prim@char`
+   |
+   = note: this link resolved to a builtin type, which is not a struct
+
+error: aborting due to 4 previous errors
+