Extend rules of dead code analysis for impls for adts to impls for types refer to adts by mu001999 · Pull Request #127017 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation5 Commits1 Checks6 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

mu001999

The rules of dead code analysis for impl blocks can be extended to self types which refer to adts.

So that we can lint the following unused struct and trait:

struct Foo; //~ ERROR struct Foo is never constructed

trait Trait { //~ ERROR trait Trait is never used fn foo(&self) {} }

impl Trait for &Foo {}

r? @pnkfelix

@mu001999

@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.

labels

Jun 27, 2024

pnkfelix

@pnkfelix

@bors

📌 Commit 8449d10 has been approved by pnkfelix

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jul 25, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jul 26, 2024

@bors

Rollup of 7 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Jul 26, 2024

@rust-timer

Rollup merge of rust-lang#127017 - mu001999-contrib:dead/enhance, r=pnkfelix

Extend rules of dead code analysis for impls for adts to impls for types refer to adts

The rules of dead code analysis for impl blocks can be extended to self types which refer to adts.

So that we can lint the following unused struct and trait:

struct Foo; //~ ERROR struct `Foo` is never constructed

trait Trait { //~ ERROR trait `Trait` is never used
    fn foo(&self) {}
}

impl Trait for &Foo {}

r? @pnkfelix

compiler-errors added a commit to compiler-errors/rust that referenced this pull request

Jul 30, 2024

@compiler-errors

…nce, r=pnkfelix"

This reverts commit a70dc29, reversing changes made to ceae371.

compiler-errors added a commit to compiler-errors/rust that referenced this pull request

Jul 30, 2024

@compiler-errors

…nce, r=pnkfelix"

This reverts commit a70dc29, reversing changes made to ceae371.

compiler-errors added a commit to compiler-errors/rust that referenced this pull request

Jul 30, 2024

@compiler-errors

…nce, r=pnkfelix"

This reverts commit a70dc29, reversing changes made to ceae371.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Jul 31, 2024

@matthiaskrgr

…hanges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

tgross35 added a commit to tgross35/rust that referenced this pull request

Aug 1, 2024

@tgross35

…hanges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

compiler-errors added a commit to compiler-errors/rust that referenced this pull request

Aug 1, 2024

@compiler-errors

…nce, r=pnkfelix"

This reverts commit a70dc29, reversing changes made to ceae371.

tgross35 added a commit to tgross35/rust that referenced this pull request

Aug 1, 2024

@tgross35

…hanges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Aug 2, 2024

@jieyouxu

…hanges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Aug 2, 2024

@jieyouxu

…hanges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Aug 3, 2024

@jieyouxu

…hanges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

compiler-errors added a commit to compiler-errors/rust that referenced this pull request

Aug 3, 2024

@compiler-errors

…nce, r=pnkfelix"

This reverts commit a70dc29, reversing changes made to ceae371.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 3, 2024

@bors

…nges, r=pnkfelix

Revert recent changes to dead code analysis

This is a revert to recent changes to dead code analysis, namely:

There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this AnonPipe type is not publically reachable -- please correct me if I'm wrong cc @NobodyXu who added these in #rust-lang#127153.

Some of these reverts (rust-lang#126315 and rust-lang#126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs?

I apologize for the size of the PR and the churn that it has on the codebase (and for reverting @mu001999's work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way.

cc @mu001999 r? @pnkfelix

Fixes rust-lang#128272 Fixes rust-lang#126169

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.