New issue
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
Setting -Dwarnings breaks feature detection in build.rs #5373
Comments
Thank you for reporting this. Setting The specific compilation failure you ran into was fixed in 1.24.1 (I hope so), but the problem persists — it will incorrectly detect features even if you upgrade, leading to less efficient code. |
I'm afraid it wasn't... If I specify
|
This is because util::once_cell is available only when rt, signal, or process is enabled, but atomic_u64_static_once_cell.rs is compiled unconditionally. Lines 9 to 10 in c390a62
tokio/tokio/src/loom/std/mod.rs Lines 4 to 5 in c390a62
Can be reproduced with:
|
I'm not sure whether this is considered a bug due to custom
RUSTFLAGS
, but treating warnings as errors in CI doesn't sound uncommon.Version
cargo tree | grep tokio
Platform
Linux <cut> 6.0.17-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jan 4 16:00:03 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Description
Steps to reproduce:
I get the following error:
My short investigation led me to the tokio's build.rs file. It looks like
-Dwarnings
affects the autocfg probe here, seen when runningcargo check
with high verbosity (-vv
):Because of this,
cargo:rustc-cfg=tokio_no_atomic_u64
is emitted in addition to others (I get the same effect withRUSTFLAGS="--cfg tokio_no_atomic_u64"
). This cfg seems to be key to trigger the error.The text was updated successfully, but these errors were encountered: