2018-11-11 11:28:56 -06:00
|
|
|
// edition:2018
|
|
|
|
|
2018-11-27 17:58:18 -06:00
|
|
|
#![feature(decl_macro, uniform_paths)]
|
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
|
|
|
|
pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported
|
2018-11-11 11:28:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mod m2 {
|
|
|
|
macro_rules! legacy_macro { () => () }
|
|
|
|
|
|
|
|
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 { () => () }
|
|
|
|
|
2018-12-09 12:49:21 -06:00
|
|
|
// Legacy macro imports create ambiguities with other names in the same namespace.
|
2018-11-11 11:28:56 -06:00
|
|
|
use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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() {}
|