The local_inner_macros modifier resolves all macro invocations made from within that macro as helpers in the same crate. So if lazy_static! expands to an invocation of __lazy_static_internal! then this would be resolved as $crate::__lazy_static_internal! rather than requiring the caller to have __lazy_static_internal in scope.
The attribute is ignored by pre-2018 compilers so lazy_static will continue to work as normal with #[macro_use].
In the future when dropping compatibility with pre-2018 compilers we can remove the local_inner_macros modifier and use our own explicit $crate:: prefixes on invocations of helper macros.
This fixes the following error when using Rust 2018 style macro imports.
The
local_inner_macros
modifier resolves all macro invocations made from within that macro as helpers in the same crate. So iflazy_static!
expands to an invocation of__lazy_static_internal!
then this would be resolved as$crate::__lazy_static_internal!
rather than requiring the caller to have__lazy_static_internal
in scope.The attribute is ignored by pre-2018 compilers so lazy_static will continue to work as normal with
#[macro_use]
.In the future when dropping compatibility with pre-2018 compilers we can remove the
local_inner_macros
modifier and use our own explicit$crate::
prefixes on invocations of helper macros.