Closed azriel91 closed 2 months ago
See https://github.com/rust-lang/rust/issues/124800 (coverage_nightly is listed in https://github.com/rust-lang/rust/issues/124800#issuecomment-2097123618). This lint will probably be allowed by default: https://github.com/rust-lang/rust/pull/124841
Heads up, with the release of rust-lang/cargo#13913 (in nightly-2024-05-19), Cargo has now gain the ability to declare --check-cfg
args directly inside the [lints]
table with [lints.rust.unexpected_cfgs.check-cfg]
[^1]:
Cargo.toml
:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
[^1]: take effect on Rust 1.80 (current nightly), is ignored on Rust 1.79 (current beta), and produce an unused warning below
This linter update seems to work for me at the package level, but not at the workspace level. Meaning if I put the line you had in every package's Cargo.toml
it takes effect, but if I put it in the workspace's Cargo.toml
it seems to make no difference:
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
Is there any way to have this configured at the workspace level?
See cargo docs: https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table
# [PROJECT_DIR]/Cargo.toml [workspace] members = ["crates/*"] [workspace.lints.rust] unsafe_code = "forbid"
# [PROJECT_DIR]/crates/bar/Cargo.toml [package] name = "bar" version = "0.1.0" [lints] workspace = true
You have to add the last one (lints.workspace = true).
Heya, in the upcoming Rust 1.80, the following attribute will cause some
cargo
commands to fail (at least it causesclippy
onrustc 1.80.0-nightly (7d83a4c13 2024-05-06)
to fail):Details are in this Rust blog post: Automatic checking of cfgs at compile-time
Error Message
The following error message appears when running clippy:
The Fix
Add a
build.rs
with the following:I think that's the right fix, as it got my build to pass.
If that's the right fix, then in
cargo-llvm-cov
it would be handy add it to theREADME.md
as part of set up.