Skip to content

pub items in binary crates should not be excluded from dead_code lint #127497

@alice-i-cecile

Description

@alice-i-cecile

When adding pub to a binary crate, the item is excluded from dead_code analysis.

While this is the right behavior for libraries, it is silly (and frustrating), because binaries cannot be used as dependencies. Instead, you have to use pub(crate) everywhere, to ensure that dead code analysis works as planned.

Meta

Reproduced on rustc 1.79

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.L-dead_codeLint: dead_codeT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions