173: Put the user-provided attributes first r=Dylan-DPC a=nox
`#[derive]` should always come after any proc macro attribute.
Co-authored-by: Anthony Ramine <n.oxyde@gmail.com>
171: Fix running tests on on "stable" Rust r=KodrAus a=Mart-Bogdan
Currently all tests can be run only on nightly toolchain.
This PR fixes this, by using compiletest_rs with feature "stable" which works on stable rust, as well as on Nightly.
**P.S.** I wanted to make some use of cfg flags, but this solution seems working, despite loading but more packages then with nightly only.
**P.P.S.** What about specifying exact version of **compiletest_rs**, like "0.3.18", which is current, to not break further builds/tests ?
Co-authored-by: Bogdan Mart <mart.bogdan@gmail.com>
Made Travis CI run all tests on almost all platforms, except oldest rustc 1.20 which is incompatible with compiletest_rs.
Now all tests could be run locally without Nightly, and on more platforms in CI.
165: Use local_inner_macros to resolve all helper macros within $crate r=Dylan-DPC a=dtolnay
This fixes the following error when using Rust 2018 style macro imports.
```rust
use bitflags::bitflags;
```
```console
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.
Co-authored-by: David Tolnay <dtolnay@gmail.com>
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.
164: add badges like rand crate r=Dylan-DPC a=bcko
Latest version, Documentation, Minimum version, and License badges are added.
Thank you for checking my pull request! :)
Co-authored-by: BC Ko <bcko@users.noreply.github.com>
I don't like this deliberately aligned, excessively indented style. It seems to
have fallen out of favor with rustfmt as well -- see their decision about
alignment of where-clauses.