Skip to content
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

Handle new unexpected_cfgs warnings #3022

Merged
merged 4 commits into from
May 6, 2024
Merged

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented May 6, 2024

Much like tokio-rs/tokio#6538 I need to silence the new warnings introduced by rust-lang/cargo#13571 about unexpected cfg condition names because the alternative is to use a build script which is undesirable and impractical as that introduces a warning about a build script syntax that isn't compatible with the MSRV.

I was able to keep this for most of the crates and further refine code gen to elide code that depended on excluded features.

@epage
Copy link

epage commented May 6, 2024

introduces a warning about a build script syntax that isn't compatible with the MSRV.

You can use the : syntax that does work with your MSRV

@kennykerr
Copy link
Collaborator Author

Thanks Ed, I'll give that a try.

@kennykerr
Copy link
Collaborator Author

kennykerr commented May 6, 2024

Weirdly this causes an entirely different warning. No idea why this is coming from the build script.

D:\git\master-rs>cargo check -p windows-targets
   Compiling windows-targets v0.52.5 (D:\git\master-rs\crates\libs\targets)
warning: missing documentation for the crate
 --> crates\libs\targets\build.rs:1:1
  |
1 | / fn main() {
2 | |     println!("cargo:rustc-check-cfg=cfg(windows_raw_dylib)");
3 | | }
  | |_^
  |
  = note: requested on the command line with `-W missing-docs`

@kennykerr
Copy link
Collaborator Author

So I was able to keep this for most of the crates and further refine code gen to elide code that depended on excluded features, which is great. 🎉

I still have to allow the warning for the windows-targets crate due to the unrelated #3022 (comment) warning that I've not yet found a workaround for.

@kennykerr
Copy link
Collaborator Author

Looks like the error is coming from the missing_docs workspace lint which is erroneously thinking the windows-targets crate lacks documentation when a build script is added. 🤷

@kennykerr kennykerr changed the title Allow unexpected_cfgs Handle new unexpected_cfgs warnings May 6, 2024
@kennykerr kennykerr merged commit 991d87c into master May 6, 2024
71 checks passed
@kennykerr kennykerr deleted the allow-unexpected_cfgs branch May 6, 2024 20:47
tbu- added a commit to tbu-/rust that referenced this pull request May 7, 2024
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
mati865 pushed a commit to mati865/windows-rs that referenced this pull request Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants