We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This will check invalid conditions, which would be quite useful for us, see the following demo:
#[cfg(target_os = "linxu")] // NOTE this typo! fn foo_for_linux() { } fn main() { }
$ cargo +nightly check -Z unstable-options -Z check-cfg Checking rust v0.1.0 (/home/steve/Documents/workspace/playground/rust) warning: unexpected `cfg` condition value: `linxu` --> src/main.rs:1:7 | 1 | #[cfg(target_os = "linxu")] | ^^^^^^^^^^^^------- | | | help: there is a expected value with a similar name: `"linux"` | = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous` = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default
Our aliases defined in build.rs are also invalid, to allow them, we can:
build.rs
// build.rs fn main() { println!("cargo:rustc-check-cfg=cfg(apple_targets)"); println!("cargo:rustc-check-cfg=cfg(bsd)"); println!("cargo:rustc-check-cfg=cfg(linux_android)"); println!("cargo:rustc-check-cfg=cfg(freebsdlike)"); println!("cargo:rustc-check-cfg=cfg(netbsdlike)"); println!("cargo:rustc-check-cfg=cfg(solarish)"); ... }
It is still unstable and only available in nightly, maybe we can enable this check when it is in stable.
The text was updated successfully, but these errors were encountered:
Oops, I just noticed this is a duplicate of #1734
Sorry, something went wrong.
Looks like we already had this since Rust nightly 1.80, see this PR: #2394
Yeah, I think we should close the issue. it's good enough to have it on nightly.
No branches or pull requests
This will check invalid conditions, which would be quite useful for us, see the following demo:
Our aliases defined in
build.rs
are also invalid, to allow them, we can:It is still unstable and only available in nightly, maybe we can enable this check when it is in stable.
The text was updated successfully, but these errors were encountered: