]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/macro_pub_in_module.rs
7d92246279fb6aed1abf2042d0a10fb05dca72f8
[rust.git] / src / test / rustdoc / macro_pub_in_module.rs
1 // aux-build:macro_pub_in_module.rs
2 // edition:2018
3 // build-aux-docs
4 // @has external_crate/some_module/macro.external_macro.html
5
6 //! See issue #74355
7 #![feature(decl_macro, no_core, rustc_attrs)]
8 #![crate_name = "krate"]
9 #![no_core]
10
11 extern crate external_crate;
12
13 pub mod inner {
14     // @has krate/inner/macro.raw_const.html
15     pub macro raw_const() {}
16
17     // @has krate/inner/macro.test.html
18     #[rustc_builtin_macro]
19     pub macro test($item:item) {}
20
21     // @has krate/inner/macro.Clone.html
22     #[rustc_builtin_macro]
23     pub macro Clone($item:item) {}
24
25     // Make sure the logic is not affected by a re-export.
26     mod private {
27         pub macro m() {}
28     }
29     // @has krate/inner/macro.renamed.html
30     pub use private::m as renamed;
31
32     // @has krate/inner/macro.external_macro.html
33     pub use ::external_crate::some_module::external_macro;
34 }
35
36 // Namespaces: Make sure the logic does not mix up a function name with a module nameā€¦
37 fn both_fn_and_mod() {
38     pub macro m() {}
39 }
40 pub mod both_fn_and_mod {
41     // @!has krate/both_fn_and_mod/macro.m.html
42 }
43
44 const __: () = {
45     pub macro m() {}
46 };
47 pub mod __ {
48     // @!has krate/__/macro.m.html
49 }