]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/macro_pub_in_module.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / 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   // @!has external_crate/macro.external_macro.html
12 extern crate external_crate;
13
14 pub mod inner {
15     // @has krate/inner/macro.raw_const.html
16     // @!has krate/macro.raw_const.html
17     pub macro raw_const() {}
18
19     // @has krate/inner/macro.test.html
20     // @!has krate/macro.test.html
21     #[rustc_builtin_macro]
22     pub macro test($item:item) {}
23
24     // @has krate/inner/macro.Clone.html
25     // @!has krate/macro.Clone.html
26     #[rustc_builtin_macro]
27     pub macro Clone($item:item) {}
28
29     // Make sure the logic is not affected by re-exports.
30     mod unrenamed {
31         // @!has krate/macro.unrenamed.html
32         #[rustc_macro_transparency = "semitransparent"]
33         pub macro unrenamed() {}
34     }
35     // @has krate/inner/macro.unrenamed.html
36     pub use unrenamed::unrenamed;
37
38     mod private {
39         // @!has krate/macro.m.html
40         pub macro m() {}
41     }
42     // @has krate/inner/macro.renamed.html
43     // @!has krate/macro.renamed.html
44     pub use private::m as renamed;
45
46     mod private2 {
47         // @!has krate/macro.m2.html
48         pub macro m2() {}
49     }
50     use private2 as renamed_mod;
51     // @has krate/inner/macro.m2.html
52     pub use renamed_mod::m2;
53
54     // @has krate/inner/macro.external_macro.html
55     // @!has krate/macro.external_macro.html
56     pub use ::external_crate::some_module::external_macro;
57 }
58
59 // Namespaces: Make sure the logic does not mix up a function name with a module nameā€¦
60 fn both_fn_and_mod() {
61     // @!has krate/macro.in_both_fn_and_mod.html
62     pub macro in_both_fn_and_mod() {}
63 }
64 pub mod both_fn_and_mod {
65     // @!has krate/both_fn_and_mod/macro.in_both_fn_and_mod.html
66 }
67
68 const __: () = {
69     // @!has krate/macro.in_both_const_and_mod.html
70     pub macro in_both_const_and_mod() {}
71 };
72 pub mod __ {
73     // @!has krate/__/macro.in_both_const_and_mod.html
74 }
75
76 enum Enum {
77     Crazy = {
78         // @!has krate/macro.this_is_getting_weird.html;
79         pub macro this_is_getting_weird() {}
80         42
81     },
82 }