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

unexpected_cfgs lint doesn't recognize some standard cfgs #124816

Open
joshlf opened this issue May 6, 2024 · 2 comments
Open

unexpected_cfgs lint doesn't recognize some standard cfgs #124816

joshlf opened this issue May 6, 2024 · 2 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-discussion Category: Discussion or questions that doesn't represent real issues. L-unexpected_cfgs Lint: unexpected_cfgs T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@joshlf
Copy link
Contributor

joshlf commented May 6, 2024

As part of google/zerocopy#1204, I discovered that the unexpected_cfgs lint fires on some standard cfgs that are common in the ecosystem. The two I discovered so far are:

I've had to manually emit directives for these. It's not that onerous, but I could imagine it getting onerous especially for projects that don't already have a build.rs script.

It would be good if the lint could be taught about some of the standard cfgs in the ecosystem to cut down on the noise.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 6, 2024
@saethlin
Copy link
Member

saethlin commented May 6, 2024

I submitted #124804 to add other well-known cfgs to thev list but it's not clear to me from the lint documentation if there is any interest in accepting additions not used by rustc/cargo, though to my mind accepting cfg(miri) is a clear precedent.

@Urgau
Copy link
Member

Urgau commented May 6, 2024

I think doc_cfg could be replaced by docsrs, it's automatically inserted by docs.rs since rust-lang/docs.rs#2390

@jieyouxu jieyouxu added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-discussion Category: Discussion or questions that doesn't represent real issues. L-unexpected_cfgs Lint: unexpected_cfgs and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-discussion Category: Discussion or questions that doesn't represent real issues. L-unexpected_cfgs Lint: unexpected_cfgs T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants