about summary refs log tree commit diff
path: root/src/librustdoc/passes/check_doc_test_visibility.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-28 21:41:00 +0200
committerGitHub <noreply@github.com>2025-08-28 21:41:00 +0200
commitf948c79911844709ad8aeea23b211fb9790257c7 (patch)
tree21eee94893fd60d7cfa906db0156556405f67dfb /src/librustdoc/passes/check_doc_test_visibility.rs
parent1f7dcc878d73c45cc40018aac6e5c767446df110 (diff)
parentf3c023433f6e44be208f9e3bb74528449da730c1 (diff)
downloadrust-f948c79911844709ad8aeea23b211fb9790257c7.tar.gz
rust-f948c79911844709ad8aeea23b211fb9790257c7.zip
Rollup merge of #142472 - GuillaumeGomez:doc-attribute-attribute, r=fmease
Add new `doc(attribute = "...")` attribute

Fixes rust-lang/rust#141123.

The implementation and purpose of this new `#[doc(attribute = "...")]` attribute is very close to `#[doc(keyword = "...")]`. Which means that luckily for us, most of the code needed was already in place and `@Noratrieb` nicely wrote a first draft that helped me implement this new attribute very fast.

Now with all this said, there is one thing I didn't do yet: adding a `rustdoc-js-std` test. I added GUI tests with search results for attributes so should be fine but I still plan on adding one for it once documentation for builtin attributes will be written into the core/std libs.

You can test it [here](https://rustdoc.crud.net/imperio/doc-attribute-attribute/foo/index.html).

cc `@Noratrieb` `@Veykril`
Diffstat (limited to 'src/librustdoc/passes/check_doc_test_visibility.rs')
-rw-r--r--src/librustdoc/passes/check_doc_test_visibility.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs
index 8028afea363..e0ea760cf3b 100644
--- a/src/librustdoc/passes/check_doc_test_visibility.rs
+++ b/src/librustdoc/passes/check_doc_test_visibility.rs
@@ -67,6 +67,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
                 | clean::ImportItem(_)
                 | clean::PrimitiveItem(_)
                 | clean::KeywordItem
+                | clean::AttributeItem
                 | clean::ModuleItem(_)
                 | clean::TraitAliasItem(_)
                 | clean::ForeignFunctionItem(..)