cuviper / autocfg

Automatic cfg for Rust compiler features
Apache License 2.0
95 stars 24 forks source link

Add support for `--check-cfg` [Rust 1.80] #64

Open cuviper opened 4 months ago

cuviper commented 4 months ago

Ref: https://blog.rust-lang.org/2024/05/06/check-cfg.html

Each cargo::rustc-cfg should have an accompanying unconditional cargo::rustc-check-cfg directive to avoid warnings like this: unexpected cfg condition name: has_foo.

We probably want something like fn emit_check(cfg: &str) to pair with the current emit. Then each AutoCfg::emit_* method should call emit_check unconditionally, while their probe still guards their emit.

Maybe a combined helper is appropriate too, like fn emit_checked(cfg: &str, cond: bool).