Skip to content

Commit 3d18f94

Browse files
committed
Auto merge of rust-lang#96630 - m-ysk:fix/issue-88038, r=notriddle
Include nonexported macro_rules! macros in the doctest target Fixes rust-lang#88038 This PR aims to include nonexported `macro_rules!` macros in the doctest target. For more details, please see the above issue.
2 parents 12d3f10 + 4698a3f commit 3d18f94

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

library/core/src/internal_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ macro_rules! impl_fn_for_zst {
190190
///
191191
/// # Example
192192
///
193-
/// ```
193+
/// ```ignore(cannot-test-this-because-non-exported-macro)
194194
/// cfg_if! {
195195
/// if #[cfg(unix)] {
196196
/// fn foo() { /* unix specific functionality */ }

src/librustdoc/doctest.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1225,16 +1225,6 @@ impl<'a, 'hir, 'tcx> intravisit::Visitor<'hir> for HirCollector<'a, 'hir, 'tcx>
12251225

12261226
fn visit_item(&mut self, item: &'hir hir::Item<'_>) {
12271227
let name = match &item.kind {
1228-
hir::ItemKind::Macro(ref macro_def, _) => {
1229-
// FIXME(#88038): Non exported macros have historically not been tested,
1230-
// but we really ought to start testing them.
1231-
let def_id = item.def_id.to_def_id();
1232-
if macro_def.macro_rules && !self.tcx.has_attr(def_id, sym::macro_export) {
1233-
intravisit::walk_item(self, item);
1234-
return;
1235-
}
1236-
item.ident.to_string()
1237-
}
12381228
hir::ItemKind::Impl(impl_) => {
12391229
rustc_hir_pretty::id_to_string(&self.map, impl_.self_ty.hir_id)
12401230
}

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ use crate::passes::collect_intra_doc_links;
9595
///
9696
/// Example:
9797
///
98-
/// ```
98+
/// ```ignore(cannot-test-this-because-non-exported-macro)
9999
/// let letters = map!{"a" => "b", "c" => "d"};
100100
/// ```
101101
///

0 commit comments

Comments
 (0)