about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-05 07:25:18 +0000
committerbors <bors@rust-lang.org>2022-05-05 07:25:18 +0000
commit3d18f945cab17c98a2d4bedd174c47a24ecfe8f4 (patch)
treee9588af9efd9a61b21b717639027cae76649dca3
parent12d3f107c1634ed41a800e220ccf99b665d906d8 (diff)
parent4698a3fb8a35994f5532d208ad060f2985ed1427 (diff)
downloadrust-3d18f945cab17c98a2d4bedd174c47a24ecfe8f4.tar.gz
rust-3d18f945cab17c98a2d4bedd174c47a24ecfe8f4.zip
Auto merge of #96630 - m-ysk:fix/issue-88038, r=notriddle
Include nonexported macro_rules! macros in the doctest target

Fixes #88038

This PR aims to include nonexported `macro_rules!` macros in the doctest target. For more details, please see the above issue.
-rw-r--r--library/core/src/internal_macros.rs2
-rw-r--r--src/librustdoc/doctest.rs10
-rw-r--r--src/librustdoc/lib.rs2
3 files changed, 2 insertions, 12 deletions
diff --git a/library/core/src/internal_macros.rs b/library/core/src/internal_macros.rs
index 7ef78e0b48a..5d4c9ba7395 100644
--- a/library/core/src/internal_macros.rs
+++ b/library/core/src/internal_macros.rs
@@ -190,7 +190,7 @@ macro_rules! impl_fn_for_zst {
 ///
 /// # Example
 ///
-/// ```
+/// ```ignore(cannot-test-this-because-non-exported-macro)
 /// cfg_if! {
 ///     if #[cfg(unix)] {
 ///         fn foo() { /* unix specific functionality */ }
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 82e367427ef..93ccf60a1de 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -1225,16 +1225,6 @@ impl<'a, 'hir, 'tcx> intravisit::Visitor<'hir> for HirCollector<'a, 'hir, 'tcx>
 
     fn visit_item(&mut self, item: &'hir hir::Item<'_>) {
         let name = match &item.kind {
-            hir::ItemKind::Macro(ref macro_def, _) => {
-                // FIXME(#88038): Non exported macros have historically not been tested,
-                // but we really ought to start testing them.
-                let def_id = item.def_id.to_def_id();
-                if macro_def.macro_rules && !self.tcx.has_attr(def_id, sym::macro_export) {
-                    intravisit::walk_item(self, item);
-                    return;
-                }
-                item.ident.to_string()
-            }
             hir::ItemKind::Impl(impl_) => {
                 rustc_hir_pretty::id_to_string(&self.map, impl_.self_ty.hir_id)
             }
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 641b0f1b364..dfc70237821 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -95,7 +95,7 @@ use crate::passes::collect_intra_doc_links;
 ///
 /// Example:
 ///
-/// ```
+/// ```ignore(cannot-test-this-because-non-exported-macro)
 /// let letters = map!{"a" => "b", "c" => "d"};
 /// ```
 ///