about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-01 19:49:19 +0000
committerbors <bors@rust-lang.org>2024-12-01 19:49:19 +0000
commit5e1440ae514d98ddfcbf1607acb64d41e07ef616 (patch)
tree2443ce65809d4ee27ddded8d02828c9199203461 /src
parent1555074ca98de5a827411cf7d7a11779bcfc90f2 (diff)
parent78dad1ee5607b164ad4a19bcf85103f9180f9101 (diff)
downloadrust-5e1440ae514d98ddfcbf1607acb64d41e07ef616.tar.gz
rust-5e1440ae514d98ddfcbf1607acb64d41e07ef616.zip
Auto merge of #133703 - matthiaskrgr:rollup-fwlw0mc, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #132974 (Properly pass linker arguments that contain commas)
 - #133403 (Make `adjust_fulfillment_errors` work with `HostEffectPredicate` and `const_conditions`)
 - #133482 (Only error raw lifetime followed by `\'` in edition 2021+)
 - #133595 (Do not emit `missing_doc_code_examples` rustdoc lint on module and a few other items)
 - #133669 (Move some functions out of const_swap feature gate)
 - #133674 (Fix chaining `carrying_add`s)
 - #133691 (Check let source before suggesting annotation)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustdoc/src/unstable-features.md4
-rw-r--r--src/librustdoc/passes/check_doc_test_visibility.rs11
2 files changed, 13 insertions, 2 deletions
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md
index e9524c0b78d..db8426492ee 100644
--- a/src/doc/rustdoc/src/unstable-features.md
+++ b/src/doc/rustdoc/src/unstable-features.md
@@ -47,6 +47,10 @@ It can be enabled using:
 #![deny(rustdoc::missing_doc_code_examples)]
 ```
 
+It is not emitted for items that cannot be instantiated/called such as fields, variants, modules,
+associated trait/impl items, impl blocks, statics and constants.
+It is also not emitted for foreign items, aliases, extern crates and imports.
+
 ## Extensions to the `#[doc]` attribute
 
 These features operate by extending the `#[doc]` attribute, and thus can be caught by the compiler
diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs
index bf851b278b8..c288a3cf2a4 100644
--- a/src/librustdoc/passes/check_doc_test_visibility.rs
+++ b/src/librustdoc/passes/check_doc_test_visibility.rs
@@ -60,8 +60,6 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
             item.kind,
             clean::StructFieldItem(_)
                 | clean::VariantItem(_)
-                | clean::AssocConstItem(..)
-                | clean::AssocTypeItem(..)
                 | clean::TypeAliasItem(_)
                 | clean::StaticItem(_)
                 | clean::ConstantItem(..)
@@ -69,6 +67,15 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -
                 | clean::ImportItem(_)
                 | clean::PrimitiveItem(_)
                 | clean::KeywordItem
+                | clean::ModuleItem(_)
+                | clean::TraitAliasItem(_)
+                | clean::ForeignFunctionItem(..)
+                | clean::ForeignStaticItem(..)
+                | clean::ForeignTypeItem
+                | clean::AssocConstItem(..)
+                | clean::AssocTypeItem(..)
+                | clean::TyAssocConstItem(..)
+                | clean::TyAssocTypeItem(..)
                 // check for trait impl
                 | clean::ImplItem(box clean::Impl { trait_: Some(_), .. })
         )