Closed joshka closed 2 months ago
Wow, that's an interesting problem -
This is not really optimal as some users have a crate named
core
. In that case this won't work. We fixed this a well in #2761. Basically it would be best to import these things in __macro_support and then use the full path$crate::__macro_support::
(As we did in #2762).
Addressed in 5960e0aa by adding these to the __macro_support in tracing / tracing_core. I didn't change all the occurrences of module_path
, as these only clash if someone has named a macro module_path
. This is less likely than file
/ line
which are small names that have many reasonable use cases.
ping
Can this also be backported to the 0.1 branch please? (Happy to add another PR for that if needed)
Motivation
This commit fixes a bug where a macro call to macros defined in the standard lib from the
tracing
andtracing-core
crates could be resolved to a local macro with the same name, causing a compilation error.Solution
This commit prefixes these calls with
::core::
to ensure that they are resolved to the standard library macros.Fixes: https://github.com/tokio-rs/tracing/issues/3023
While this fixes the specific issue at hand, there's likely many macro calls that are impacted by this problem - specifically every call to module_path (there are many). I haven't updated all of those places as I was unsure if that was a good idea as there's about 220 calls of that macro. I also haven't checked for other macros that would also be problematic.