about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-10 19:12:54 +0000
committerbors <bors@rust-lang.org>2016-12-10 19:12:54 +0000
commitc79d0b40a0e3e9f87ea022054577c5766b36e819 (patch)
tree6548462886e5ab4788aef2777ec12195c0612fe6
parent576a361cd0b8594425c5f1856a6ead4ebbeffd57 (diff)
parent6ffa274bb5095ad13b7df1e284d526a7c39e3f46 (diff)
downloadrust-c79d0b40a0e3e9f87ea022054577c5766b36e819.tar.gz
rust-c79d0b40a0e3e9f87ea022054577c5766b36e819.zip
Auto merge of #38239 - jseyfried:fix_doc_tests_on_macros, r=eddyb
Fix doc-tests on exported `macro_rules!`

Fixes #38219.
r? @eddyb
-rw-r--r--src/librustdoc/test.rs4
-rw-r--r--src/test/rustdoc/issue-38219.rs18
2 files changed, 22 insertions, 0 deletions
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index 009330065f3..794b7b91bd2 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -537,4 +537,8 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> {
             intravisit::walk_struct_field(this, f);
         });
     }
+
+    fn visit_macro_def(&mut self, macro_def: &'hir hir::MacroDef) {
+        self.visit_testable(macro_def.name.to_string(), &macro_def.attrs, |_| ());
+    }
 }
diff --git a/src/test/rustdoc/issue-38219.rs b/src/test/rustdoc/issue-38219.rs
new file mode 100644
index 00000000000..19b338bf560
--- /dev/null
+++ b/src/test/rustdoc/issue-38219.rs
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:--test
+// should-fail
+
+/// ```
+/// fail
+/// ```
+#[macro_export]
+macro_rules! foo { () => {} }