Open
Description
I tried this code:
macro_rules! warn { () => {} }
pub(crate) use warn;
fn main() { }
I expected it to compile.
Instead, it produces an error like this:
error[E0659]: `warn` is ambiguous
--> src/main.rs:3:16
|
3 | pub(crate) use warn;
| ^^^^ ambiguous name
|
= note: ambiguous because of a name conflict with a builtin attribute
= note: `warn` could refer to a built-in attribute
note: `warn` could also refer to the macro defined here
--> src/main.rs:1:1
|
1 | macro_rules! warn { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
macro_rules
are impossible to qualify it as self::warn
or crate::warn
or super::warn
.
use r#warn
doesn't do anything useful too.
The only thing you can do is something stupid like this:
macro_rules! warn_hack { ($($tt:tt)*) => { warn!($($tt)*) } }
pub(crate) use warn_hack as warn;
This will work, the fact that it works like that is why I consider this a bug.
Meta
Occurs on all versions with --edition 2018
or later.