mirror of
https://gitee.com/openharmony/third_party_rust_bitflags
synced 2025-02-07 16:07:12 +00:00
e72681e4fa
This fixes the following error when using Rust 2018 style macro imports. use bitflags::bitflags; error: cannot find macro `__bitflags!` in this scope --> src/main.rs:5:1 | 5 | / bitflags! { 6 | | struct Flags: u32 { 7 | | const A = 0b00000001; 8 | | const B = 0b00000010; ... | 11 | | } 12 | | } | |_^ help: you could try the macro: `bitflags` | The `local_inner_macros` modifier resolves all macro invocations made from within that macro as helpers in the same crate. So if `bitflags!` expands to an invocation of `__bitflags!` then this would be resolved as `$crate::__bitflags!` rather than requiring the caller to have `__bitflags` in scope. The attribute is ignored by pre-2018 compilers so bitflags 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.