rust-lang / rust-lang/rust

`unexpected_cfgs` lint doesn't recognize some standard `cfg`s

Open
#124,816 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints C-discussion L-unexpected_cfgs T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

As part of https://github.com/google/zerocopy/pull/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the linked zerocopy PR #1204, especially the manually emitted directives for doc_cfg and kani, then locate the Rust compiler entry point for the unexpected_cfgs lint. Define which ecosystem cfgs should be recognized and add coverage showing that these uses no longer produce unexpected-cfg warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.