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 unexpected_cfgs #1785

Closed
wants to merge 1 commit into from
Closed

Conversation

dswij
Copy link

@dswij dswij commented May 8, 2024

@dswij dswij changed the title fix unexpected cfg on nightly handle unexpected_cfgs May 8, 2024
@Thomasdezeeuw
Copy link
Collaborator

I don't think is the way to solve it.

We probably we want to add #![allow(unexpected_cfgs)], but we'll have to take a look at whether not that requires a MSRV increase.

@dswij dswij force-pushed the unexpected-cfg-nightly branch 3 times, most recently from 40f8cdd to 6bce89e Compare May 10, 2024 04:06
@Thomasdezeeuw
Copy link
Collaborator

I meant remove all the CI setup stuff, just #![allow(unexpected_cfgs)].

@Darksonn
Copy link
Contributor

You probably need #![allow(unknown_lints, unexpected_cfgs)]. See also tokio-rs/tokio#6538.

@Urgau
Copy link

Urgau commented May 23, 2024

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 --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(foo)'] }

Note that the diagnostic output of the lint has been updated to suggest the [lints] approach first. You can use it to guide you through the --check-cfg arguments that may need to be added.

Footnotes

  1. take effect on Rust 1.80 (current nightly), is ignored on Rust 1.79 (current beta), and produce an unused warning below (only in local-dev, not when used as a dep)

@Thomasdezeeuw
Copy link
Collaborator

Closing in favour of #1787, which adds the two expected cfgs instead of ignore the lint (since I think it's quite useful for Mio).

@dswij dswij deleted the unexpected-cfg-nightly branch May 26, 2024 23:58
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.

None yet

4 participants