Skip to content

Update unexpected_cfgs lint for Cargo new check-cfg config#125219

Merged
bors merged 6 commits intorust-lang:masterfrom
Urgau:check-cfg-cargo-config
May 20, 2024
Merged

Update unexpected_cfgs lint for Cargo new check-cfg config#125219
bors merged 6 commits intorust-lang:masterfrom
Urgau:check-cfg-cargo-config

Conversation

@Urgau
Copy link
Copy Markdown
Member

@Urgau Urgau commented May 17, 2024

This PR updates the diagnostics output of the unexpected_cfgs lint for Cargo new check-cfg config.

It's a simple and cost-less alternative to the build-script cargo::rustc-check-cfg instruction.

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(foo, values("bar"))'] }

This PR also adds a Cargo specific section regarding check-cfg and Cargo inside rustc's book (motivation is described inside the file, but mainly check-cfg is a rustc feature not a Cargo one, Cargo only enabled the feature, it does not own it; T-cargo even considers the check-cfg lint config to be an implementation detail).

This PR also updates the links to refer to that sub-page when using Cargo from rustc.

As well as updating the lint doc to refer to the check-cfg docs.

Not to be merged before rust-lang/cargo#13913 reaches master! (EDIT: merged in #125237)

@rustbot label +F-check-cfg
r? @fmease (feel free to roll)
Fixes #124800
cc @epage @weihanglo

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-check-cfg --check-cfg merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New rustc nightly suggests adding a build.rs to use conditional compilation

10 participants