2018-11-11 11:28:56 -06:00
|
|
|
// edition:2018
|
|
|
|
|
2018-12-26 18:38:43 -06:00
|
|
|
#![feature(decl_macro)]
|
2018-11-11 11:28:56 -06:00
|
|
|
|
|
|
|
mod m1 {
|
2018-12-09 12:49:21 -06:00
|
|
|
// Non-exported legacy macros are treated as `pub(crate)`.
|
2018-11-11 11:28:56 -06:00
|
|
|
macro_rules! legacy_macro { () => () }
|
|
|
|
|
2018-12-09 12:49:21 -06:00
|
|
|
use legacy_macro as _; // OK
|
|
|
|
pub(crate) use legacy_macro as _; // OK
|
2021-11-05 14:43:55 -05:00
|
|
|
pub use legacy_macro as _; //~ ERROR `legacy_macro` is only public within the crate, and cannot be re-exported outside
|
2018-11-11 11:28:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mod m2 {
|
|
|
|
macro_rules! legacy_macro { () => () }
|
|
|
|
|
2018-12-26 18:38:43 -06:00
|
|
|
#[allow(non_camel_case_types)]
|
2018-11-11 11:28:56 -06:00
|
|
|
type legacy_macro = u8;
|
|
|
|
|
2018-12-09 12:49:21 -06:00
|
|
|
// Legacy macro imports don't prevent names from other namespaces from being imported.
|
2018-11-11 11:28:56 -06:00
|
|
|
use legacy_macro as _; // OK
|
|
|
|
}
|
|
|
|
|
|
|
|
mod m3 {
|
|
|
|
macro legacy_macro() {}
|
|
|
|
|
|
|
|
fn f() {
|
|
|
|
macro_rules! legacy_macro { () => () }
|
|
|
|
|
2023-05-29 15:36:06 -05:00
|
|
|
use legacy_macro as _; // OK
|
2018-11-11 11:28:56 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod exported {
|
2018-12-09 12:49:21 -06:00
|
|
|
// Exported legacy macros are treated as `pub`.
|
2018-11-11 11:28:56 -06:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! legacy_macro { () => () }
|
|
|
|
|
2018-12-09 12:49:21 -06:00
|
|
|
pub use legacy_macro as _; // OK
|
2018-11-11 11:28:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|