rustc_lint::builtin

Static EXPLICIT_BUILTIN_CFGS_IN_FLAGS

source
pub static EXPLICIT_BUILTIN_CFGS_IN_FLAGS: &'static Lint
Expand description

The explicit_builtin_cfgs_in_flags lint detects builtin cfgs set via the --cfg flag.

§Example

rustc --cfg unix
fn main() {}

This will produce:

error: unexpected `--cfg unix` flag
  |
  = note: config `unix` is only supposed to be controlled by `--target`
  = note: manually setting a built-in cfg can and does create incoherent behaviors
  = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default

§Explanation

Setting builtin cfgs can and does produce incoherent behavior, it’s better to the use the appropriate rustc flag that controls the config. For example setting the windows cfg but on Linux based target.