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

Silence unexpected-cfgs warnings due to #[cfg(loom)] #703

Merged
merged 4 commits into from May 5, 2024

Conversation

Darksonn
Copy link
Contributor

@Darksonn Darksonn commented May 5, 2024

Silence warnings from rust-lang/cargo#13571 due to our use of #[cfg(loom)]

@Darksonn Darksonn merged commit 0c17e99 into master May 5, 2024
15 checks passed
@Darksonn Darksonn deleted the alice/allow-unexpected-cfgs branch May 5, 2024 12:19
@Urgau
Copy link

Urgau commented May 5, 2024

Silencing the lint is very unfortunate. I understand that you may not want to use a build.rs, if you don't already have one, maybe you could use a custom CI step/job to still have the benefits of the lint.

Something like RUSTFLAGS='--check-cfg=cfg(loom) -Funexpected_cfgs' cargo check, maybe.

@Darksonn
Copy link
Contributor Author

Darksonn commented May 5, 2024

I'm not going to do that right now. But I opened a bug.

@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 silencing of the lint as 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

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

3 participants