about summary refs log tree commit diff
path: root/tests/rustdoc-json/doc_attribute.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-06-13 21:02:26 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-28 15:56:30 +0200
commit75cbd05d19a7cfb0819f15a57f2561cd28a956a7 (patch)
tree57a503a0946816eb448d4d5d8964b9f49493ea1e /tests/rustdoc-json/doc_attribute.rs
parentab0ee84eac9732e4e81e559c688846b4c1bd400a (diff)
downloadrust-75cbd05d19a7cfb0819f15a57f2561cd28a956a7.tar.gz
rust-75cbd05d19a7cfb0819f15a57f2561cd28a956a7.zip
Add tests for `doc(attribute = "...")` attribute
Diffstat (limited to 'tests/rustdoc-json/doc_attribute.rs')
-rw-r--r--tests/rustdoc-json/doc_attribute.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/rustdoc-json/doc_attribute.rs b/tests/rustdoc-json/doc_attribute.rs
new file mode 100644
index 00000000000..9e1a711f0b7
--- /dev/null
+++ b/tests/rustdoc-json/doc_attribute.rs
@@ -0,0 +1,18 @@
+// Doc attributes (`#[doc(attribute = "...")]` should not be generated in rustdoc JSON output
+// and this test ensures it.
+
+#![feature(rustdoc_internals)]
+#![no_std]
+
+//@ !has "$.index[?(@.name=='repr')]"
+//@ has "$.index[?(@.name=='foo')]"
+
+#[doc(attribute = "repr")]
+/// this is a test!
+pub mod foo {}
+
+//@ !has "$.index[?(@.name=='forbid')]"
+//@ !has "$.index[?(@.name=='bar')]"
+#[doc(attribute = "forbid")]
+/// hello
+mod bar {}