about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-04-19 21:10:40 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-04-19 21:10:40 +0200
commit88a5e1ef683673c7e1b16b399d745d01ad540a19 (patch)
treeebb0e56a345bd2e623efcd5de39784e34aa473a8 /tests
parente0437ec364017b11b5e63d1c09e3204029d8b497 (diff)
downloadrust-88a5e1ef683673c7e1b16b399d745d01ad540a19.tar.gz
rust-88a5e1ef683673c7e1b16b399d745d01ad540a19.zip
Add regression test for #140026
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-ui/intra-doc/empty-associated-items.rs8
-rw-r--r--tests/rustdoc-ui/intra-doc/empty-associated-items.stderr14
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/intra-doc/empty-associated-items.rs b/tests/rustdoc-ui/intra-doc/empty-associated-items.rs
new file mode 100644
index 00000000000..ea94cb349ad
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/empty-associated-items.rs
@@ -0,0 +1,8 @@
+// This test ensures that an empty associated item will not crash rustdoc.
+// This is a regression test for <https://github.com/rust-lang/rust/issues/140026>.
+
+#[deny(rustdoc::broken_intra_doc_links)]
+
+/// [`String::`]
+//~^ ERROR
+pub struct Foo;
diff --git a/tests/rustdoc-ui/intra-doc/empty-associated-items.stderr b/tests/rustdoc-ui/intra-doc/empty-associated-items.stderr
new file mode 100644
index 00000000000..b0527916ab5
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/empty-associated-items.stderr
@@ -0,0 +1,14 @@
+error: unresolved link to `String::`
+  --> $DIR/empty-associated-items.rs:6:7
+   |
+LL | /// [`String::`]
+   |       ^^^^^^^^ the struct `String` has no field or associated item named ``
+   |
+note: the lint level is defined here
+  --> $DIR/empty-associated-items.rs:4:8
+   |
+LL | #[deny(rustdoc::broken_intra_doc_links)]
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+