Skip to content

Commit c79d0b4

Browse files
committed
Auto merge of #38239 - jseyfried:fix_doc_tests_on_macros, r=eddyb
Fix doc-tests on exported `macro_rules!` Fixes #38219. r? @eddyb
2 parents 576a361 + 6ffa274 commit c79d0b4

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/librustdoc/test.rs

+4
Original file line numberDiff line numberDiff line change
@@ -537,4 +537,8 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> {
537537
intravisit::walk_struct_field(this, f);
538538
});
539539
}
540+
541+
fn visit_macro_def(&mut self, macro_def: &'hir hir::MacroDef) {
542+
self.visit_testable(macro_def.name.to_string(), &macro_def.attrs, |_| ());
543+
}
540544
}

src/test/rustdoc/issue-38219.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags:--test
12+
// should-fail
13+
14+
/// ```
15+
/// fail
16+
/// ```
17+
#[macro_export]
18+
macro_rules! foo { () => {} }

0 commit comments

Comments
 (0)