about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-29 16:53:30 -0400
committerGitHub <noreply@github.com>2017-03-29 16:53:30 -0400
commitea9c8b992c2155f3cb2e19dc0e7f65ce16158889 (patch)
treebfca9f97a434f6a471abae1f50516e2695197b75 /src/test
parenta9dc8ac7ac5dee13675b01ea7db8a93d90d40cf2 (diff)
parentd8fc5b80b61f662dd0d63d236875ade5a3f1129c (diff)
downloadrust-ea9c8b992c2155f3cb2e19dc0e7f65ce16158889.tar.gz
rust-ea9c8b992c2155f3cb2e19dc0e7f65ce16158889.zip
Rollup merge of #40814 - abonander:issue_39436, r=jseyfried
Rustdoc: memoize `pub use`-reexported macros so they don't appear twice in docs

Closes #39436

Preserves existing behavior for `#[macro_reexport]`. `pub use`'d macros are shown as reexports unless inlined, and also correctly obey `#[doc(hidden)]`.

r? @jseyfried

cc @SergioBenitez
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/auxiliary/pub-use-extern-macros.rs30
-rw-r--r--src/test/rustdoc/pub-use-extern-macros.rs31
2 files changed, 61 insertions, 0 deletions
diff --git a/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs b/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs
new file mode 100644
index 00000000000..70d174a149d
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs
@@ -0,0 +1,30 @@
+// Copyright 2017 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.
+#![crate_name="macros"]
+
+#[macro_export]
+macro_rules! foo {
+    () => {};
+}
+
+#[macro_export]
+macro_rules! bar {
+    () => {};
+}
+
+#[macro_export]
+macro_rules! baz {
+    () => {};
+}
+
+#[macro_export]
+macro_rules! quux {
+    () => {};
+}
diff --git a/src/test/rustdoc/pub-use-extern-macros.rs b/src/test/rustdoc/pub-use-extern-macros.rs
new file mode 100644
index 00000000000..3f8f6f9544e
--- /dev/null
+++ b/src/test/rustdoc/pub-use-extern-macros.rs
@@ -0,0 +1,31 @@
+// Copyright 2017 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.
+
+// aux-build:pub-use-extern-macros.rs
+
+#![feature(use_extern_macros, macro_reexport)]
+
+// @has pub_use_extern_macros/macro.foo.html
+// @!has pub_use_extern_macros/index.html 'pub use macros::foo;'
+#[macro_reexport(foo)] extern crate macros;
+
+// @has pub_use_extern_macros/index.html 'pub use macros::bar;'
+// @!has pub_use_extern_macros/macro.bar.html
+pub use macros::bar;
+
+// @has pub_use_extern_macros/macro.baz.html
+// @!has pub_use_extern_macros/index.html 'pub use macros::baz;'
+#[doc(inline)]
+pub use macros::baz;
+
+// @!has pub_use_extern_macros/macro.quux.html
+// @!has pub_use_extern_macros/index.html 'pub use macros::quux;'
+#[doc(hidden)]
+pub use macros::quux;