]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/macro_pub_in_module.rs
Update test assertions (showcases bug)
[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
5 //! See issue #74355
6 #![feature(decl_macro, no_core, rustc_attrs)]
7 #![crate_name = "krate"]
8 #![no_core]
9
10 // @has external_crate/some_module/macro.external_macro.html
11 extern crate external_crate;
12
13 pub mod inner {
14     // @has krate/inner/macro.raw_const.html
15     // @!has krate/macro.raw_const.html
16     pub macro raw_const() {}
17
18     // @has krate/inner/macro.test.html
19     // @!has krate/macro.test.html
20     #[rustc_builtin_macro]
21     pub macro test($item:item) {}
22
23     // @has krate/inner/macro.Clone.html
24     // @!has krate/macro.Clone.html
25     #[rustc_builtin_macro]
26     pub macro Clone($item:item) {}
27
28     // Make sure the logic is not affected by re-exports.
29     mod unrenamed {
30         // @!has krate/macro.unrenamed.html
31         #[rustc_macro_transparency = "semitransparent"]
32         pub macro unrenamed() {}
33     }
34     // @has krate/inner/macro.unrenamed.html
35     pub use unrenamed::unrenamed;
36
37     mod private {
38         // @!has krate/macro.m.html
39         pub macro m() {}
40     }
41     // @has krate/inner/macro.renamed.html
42     // @!has krate/macro.renamed.html
43     pub use private::m as renamed;
44
45     mod private2 {
46         // @!has krate/macro.m2.html
47         pub macro m2() {}
48     }
49     use private2 as renamed_mod;
50     // @has krate/inner/macro.m2.html
51     pub use renamed_mod::m2;
52
53     // @has krate/inner/macro.external_macro.html
54     // @!has krate/macro.external_macro.html
55     pub use ::external_crate::some_module::external_macro;
56 }
57
58 // Namespaces: Make sure the logic does not mix up a function name with a module nameā€¦
59 fn both_fn_and_mod() {
60     // @!has krate/macro.in_both_fn_and_mod.html
61     pub macro in_both_fn_and_mod() {}
62 }
63 pub mod both_fn_and_mod {
64     // @!has krate/both_fn_and_mod/macro.in_both_fn_and_mod.html
65 }
66
67 const __: () = {
68     // @!has krate/macro.in_both_const_and_mod.html
69     pub macro in_both_const_and_mod() {}
70 };
71 pub mod __ {
72     // @!has krate/__/macro.in_both_const_and_mod.html
73 }