rust-lang / rust-lang/rust

Mark existing well-known cfg as unknown

Open
#117,778 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-check-cfg C-discussion T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

There is no way to mark existing well-known attributes as unknown, is there? Specifically, I think it would be nice if there was a way for rustc to raise a warning when it encounters cfg(test) (which cargo could then make use of for crates that use lib.test = false).

Originally posted by @jplatte in https://github.com/rust-lang/rust/issues/82450#issuecomment-1802229763

@rustbot label +C-discussion +F-check-cfg -needs-triage

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

Start by reviewing rustc's existing check-cfg handling for well-known attributes, focusing on cfg(test), and then examine how Cargo's lib.test = false setting could consume a warning. The work is complete when existing well-known cfg attributes can be marked unknown and rustc warns for cfg(test) in the relevant configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.