Skip to content

Marks ADT live if it appears in pattern #142485

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mu001999
Copy link
Contributor

@mu001999 mu001999 commented Jun 14, 2025

Marks ADT live if it appears in pattern, it implies the construction of the ADT.

  1. Then we can detect unused private ADTs impl Default, without special logics for Default and other std traits.
  2. We can also remove rustc_trivial_field_reads on Default, and the logic in should_ignore_item (introduced by Detect unused structs which derived Default #126302).

Fixes #120770

Extracted from #128637.
r? petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 14, 2025
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the dead-code/adt-pattern branch from b41ce8e to 52167e0 Compare June 14, 2025 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dead_code false positive introduced in rustc 1.78.0-nightly (8ace7ea1f 2024-02-07)
4 participants