| category | Build Utility |
|---|---|
| description | Attributes to do conditional compilation based on rust version/channel |
Neat crate, but not as useful as you'd hope. In rustc 1.36, custom attributes cannot:
- Be applied as inner attributes
- Be applied to modules
- Be applied to crates
Some tracking issues:
- rust-lang/rust#54726 - Tracking issue for custom inner attributes
- rust-lang/rust#54727 - Tracking issue for procedural macros and "hygiene 2.0"
This has forced me to abandon for now:
| version | thoroughness | understanding | rating | notes |
|---|---|---|---|---|
| 1.0.0 | high | medium | positive | Full Review |
| file | rating | notes |
|---|---|---|
| src/attr.rs | ✔️ | |
| src/bound.rs | ✔️ | |
| src/date.rs | ✔️ | Custom parse impls |
| src/expr.rs | ✔️ | Custom keywords |
| src/lib.rs | ✔️ | Custom HTML docs, error handling |
| src/rustc.rs | ✔️ | Command [1] |
| src/time.rs | ❔ | Parsing date times seems a bit out-of-scope for this crate. OTOH, this is only used for an error message example by date.rs. |
| src/version.rs | ✔️ | |
| .cargo_vcs_info.json | ✔️ | |
| .cargo-ok | ✔️ | |
| .gitignore | ✔️ | |
| .travis.yml | ✔️ | Tests 1.31.0 (MSRV?), stable, beta, nightly |
| Cargo.lock | ✔️ | Recent-looking proc-macro2, quote, syn, unicode-xid |
| Cargo.toml | ✔️ | license = "MIT OR Apache-2.0" |
| Cargo.toml.orig | ✔️ | license = "MIT OR Apache-2.0" |
| LICENSE-APACHE | ✔️ | Skimmed |
| LICENSE-MIT | ✔️ | |
| README.md | ✔️ | MIT OR Apache-2.0 |
| Other | Rating | Notes |
|---|---|---|
| unsafe | ✔️ | None |
| fs | ✔️ | None |
| io | ✔️ | Command [1] |
| docs | ✔️ | Duplicated between readme and src/lib.rs |
| tests | ❔ | Could use more test coverage |
Note 1: pub fn version() uses Command
Executes %RUSTC% --version.
%RUSTC% is the only user controlled arg, and already set/read/executed by cargo.
Baddies could simply modify %PATH% and do worse damage.
LGTM! 👍
I really wish I had dived into this crate's src before doing my own proc macros.
syn actually looks quite neato, I should probably replace my hand rolled logic in jni-glue-macros with it.
I should also consider testing with -Z minimal-versions (may require nightly currently?)