chore: fix unexpected cfg warning#3660
Conversation
|
Started with rust-lang/cargo#13571 |
|
A build file slows down compilation measurably. Can it be solved without? |
|
I think another workaround is to allow this lint. |
This reverts commit d543d8e.
|
Changed to allow it. |
|
Note that it's possible to add a ci check that still runs the lint, with your custom |
|
I have known it, but I do not think that it is a good idea to use |
|
What do you mean by that? |
|
@dtolnay has a neat approach to avoid the build.rs build time penalty: tokio-rs/tokio#6542 |
|
That's clever, but I think currently my preferred solution is to just allow the lint normally, and optionally add a CI job checking it. |
This allows to find solutions to the false positives that were found in the ecosystem before turning it to `warn` by default again. Most projects hit by this seem to just disable the warning, which indicates that it isn't working as expected. CC rust-lang#124800 CC rust-lang#124804 CC rust-lang#124821 CC hyperium/hyper#3660 CC microsoft/windows-rs#3022 CC rust-bitcoin/rust-bitcoin#2748 CC tokio-rs/tokio#6538
2899574 to
1791205
Compare
|
Updated to allow |
1791205 to
51b2fca
Compare
|
Heads up, with the release of rust-lang/cargo#13913 (in nightly-2024-05-19), there is no longer any need for the kind of workarounds employed in this PR. Cargo has now gain the ability to declare
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(foo)'] }
Footnotes
|
This reverts commit 56ef0cc.
Fixes unexpected cfg warnings, which cause the ci fail.
https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg