2017-03-24 21:37:55 -05:00
|
|
|
#![feature(decl_macro)]
|
|
|
|
|
|
|
|
pub mod foo {
|
|
|
|
pub use self::bar::m;
|
|
|
|
mod bar {
|
|
|
|
fn f() -> u32 { 1 }
|
|
|
|
pub macro m() {
|
2021-07-22 14:28:02 -05:00
|
|
|
f()
|
2017-03-24 21:37:55 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-24 11:54:23 -05:00
|
|
|
|
|
|
|
pub struct SomeType;
|
|
|
|
|
2018-06-28 19:45:47 -05:00
|
|
|
// `$crate`
|
|
|
|
pub macro uses_dollar_crate_modern() {
|
2018-06-24 11:54:23 -05:00
|
|
|
type Alias = $crate::SomeType;
|
|
|
|
}
|
2018-06-28 19:45:47 -05:00
|
|
|
|
|
|
|
pub macro define_uses_dollar_crate_modern_nested($uses_dollar_crate_modern_nested: ident) {
|
|
|
|
macro $uses_dollar_crate_modern_nested() {
|
|
|
|
type AliasCrateModernNested = $crate::SomeType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! define_uses_dollar_crate_legacy_nested {
|
|
|
|
() => {
|
|
|
|
macro_rules! uses_dollar_crate_legacy_nested {
|
|
|
|
() => {
|
|
|
|
type AliasLegacyNested = $crate::SomeType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// `crate`
|
|
|
|
pub macro uses_crate_modern() {
|
|
|
|
type AliasCrate = crate::SomeType;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub macro define_uses_crate_modern_nested($uses_crate_modern_nested: ident) {
|
|
|
|
macro $uses_crate_modern_nested() {
|
|
|
|
type AliasCrateModernNested = crate::SomeType;
|
|
|
|
}
|
|
|
|
}
|