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

Disable compiler warnings for known custom cfg values #3384

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

FreezyLemon
Copy link
Contributor

Context.

TL;DR: Custom cfgs are considered unexpected by rustc, so they will produce a warning (on 1.80+) unless they're added to a list of known custom cfgs.

cfgs that are not features or dependencies from Cargo.toml
(so e.g. cfgs set by build.rs or external tools like cargo-fuzz)
will cause compiler warnings starting with Rust 1.80.
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.72%. Comparing base (3c3a26f) to head (ef71179).
Report is 22 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3384      +/-   ##
==========================================
+ Coverage   88.52%   88.72%   +0.20%     
==========================================
  Files          89       89              
  Lines       28323    27753     -570     
==========================================
- Hits        25074    24625     -449     
+ Misses       3249     3128     -121     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shssoichiro
Copy link
Collaborator

I think this looks fine, but I'm curious, is this not solvable in some way other than ignoring? For example, can we fix this in our build.rs?

@FreezyLemon
Copy link
Contributor Author

Yes that's possible too, but it looks like the [lints] entry is meant for cfgs that are statically known while the build.rs approach is more meant for dynamic addition of cfgs. At least it reads that way to me, but I really don't have a preference one way or the other

Copy link
Collaborator

@lu-zero lu-zero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I like the Cargo.toml better since it is easier to discover

@shssoichiro shssoichiro merged commit 554abdf into xiph:master Jun 1, 2024
27 checks passed
@FreezyLemon FreezyLemon deleted the add-custom-cfgs branch June 2, 2024 09:28
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.

3 participants