David Tolnay e72681e4fa
Use local_inner_macros to resolve all helper macros within $crate
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.
2018-07-26 09:58:34 -07:00
..