2020-10-14 14:12:03 -05:00
|
|
|
// aux-build:macro_pub_in_module.rs
|
|
|
|
// edition:2018
|
|
|
|
// build-aux-docs
|
|
|
|
|
2020-10-12 12:50:12 -05:00
|
|
|
//! See issue #74355
|
2020-10-13 13:25:19 -05:00
|
|
|
#![feature(decl_macro, no_core, rustc_attrs)]
|
2020-10-12 12:50:12 -05:00
|
|
|
#![crate_name = "krate"]
|
2020-10-13 13:25:19 -05:00
|
|
|
#![no_core]
|
2020-10-12 12:50:12 -05:00
|
|
|
|
2020-12-27 15:14:43 -06:00
|
|
|
// @has external_crate/some_module/macro.external_macro.html
|
|
|
|
// @!has external_crate/macro.external_macro.html
|
2020-10-14 14:12:03 -05:00
|
|
|
extern crate external_crate;
|
|
|
|
|
2020-10-13 13:25:19 -05:00
|
|
|
pub mod inner {
|
2020-10-14 14:12:03 -05:00
|
|
|
// @has krate/inner/macro.raw_const.html
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.raw_const.html
|
2020-10-14 14:12:03 -05:00
|
|
|
pub macro raw_const() {}
|
2020-10-13 13:25:19 -05:00
|
|
|
|
|
|
|
// @has krate/inner/macro.test.html
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.test.html
|
2020-10-13 13:25:19 -05:00
|
|
|
#[rustc_builtin_macro]
|
|
|
|
pub macro test($item:item) {}
|
|
|
|
|
|
|
|
// @has krate/inner/macro.Clone.html
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.Clone.html
|
2020-10-13 13:25:19 -05:00
|
|
|
#[rustc_builtin_macro]
|
|
|
|
pub macro Clone($item:item) {}
|
2020-10-14 14:12:03 -05:00
|
|
|
|
2020-12-27 12:05:35 -06:00
|
|
|
// Make sure the logic is not affected by re-exports.
|
|
|
|
mod unrenamed {
|
|
|
|
// @!has krate/macro.unrenamed.html
|
|
|
|
#[rustc_macro_transparency = "semitransparent"]
|
|
|
|
pub macro unrenamed() {}
|
|
|
|
}
|
|
|
|
// @has krate/inner/macro.unrenamed.html
|
|
|
|
pub use unrenamed::unrenamed;
|
|
|
|
|
2020-10-14 14:12:03 -05:00
|
|
|
mod private {
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.m.html
|
2020-10-14 14:12:03 -05:00
|
|
|
pub macro m() {}
|
|
|
|
}
|
|
|
|
// @has krate/inner/macro.renamed.html
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.renamed.html
|
2020-10-14 14:12:03 -05:00
|
|
|
pub use private::m as renamed;
|
|
|
|
|
2020-12-27 12:05:35 -06:00
|
|
|
mod private2 {
|
|
|
|
// @!has krate/macro.m2.html
|
|
|
|
pub macro m2() {}
|
|
|
|
}
|
|
|
|
use private2 as renamed_mod;
|
|
|
|
// @has krate/inner/macro.m2.html
|
|
|
|
pub use renamed_mod::m2;
|
|
|
|
|
2020-10-14 14:12:03 -05:00
|
|
|
// @has krate/inner/macro.external_macro.html
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.external_macro.html
|
2020-10-14 14:12:03 -05:00
|
|
|
pub use ::external_crate::some_module::external_macro;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Namespaces: Make sure the logic does not mix up a function name with a module name…
|
|
|
|
fn both_fn_and_mod() {
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.in_both_fn_and_mod.html
|
|
|
|
pub macro in_both_fn_and_mod() {}
|
2020-10-14 14:12:03 -05:00
|
|
|
}
|
|
|
|
pub mod both_fn_and_mod {
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/both_fn_and_mod/macro.in_both_fn_and_mod.html
|
2020-10-14 14:12:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const __: () = {
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/macro.in_both_const_and_mod.html
|
|
|
|
pub macro in_both_const_and_mod() {}
|
2020-10-14 14:12:03 -05:00
|
|
|
};
|
|
|
|
pub mod __ {
|
2020-12-27 12:05:35 -06:00
|
|
|
// @!has krate/__/macro.in_both_const_and_mod.html
|
2020-10-12 12:50:12 -05:00
|
|
|
}
|