rust-lang / rust-lang/rust

Allow `dead_code` lint to be configured to validate that all pub code is used within the workspace

Open
#120,079 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints C-enhancement C-feature-request L-dead_code T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

When this setting is true, dead_code would analyze an entire workspace, checking that all code is used somewhere in the workspace.

This is particularly useful in projects that have libraries (for compilation speed or modularity reasons) that are never intended to be published. In those cases, it's easy to accidentally forget to remove dead code, as pub library types and traits and functions and constants are exempted.

With the addition of workspace-level lint controls, this feels like it may actually be possible. #74970 is related, but only targets binary crates.

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 reading the existing dead_code lint and the workspace-level lint controls mentioned in the issue, then review related issue #74970. Determine the design needed to validate use of public code across a workspace, including libraries, and define tests that distinguish used from unused public items.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.