Skip to content
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

Do not complain about unused code when used in impl Self type #63317

Merged
merged 3 commits into from
Aug 27, 2019

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Aug 6, 2019

Fix #18290.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 6, 2019
@estebank
Copy link
Contributor Author

estebank commented Aug 6, 2019


#![deny(dead_code)]

const TLC: usize = 4;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No complaint about TLC being unused

}

struct X;
struct Y;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No complaint about Y being unused

}

fn main() {}
fn main() {
let x = Foo::Bar(42);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is added to remove the warning for Foo::Bar, not Foo.

@@ -5,12 +5,15 @@
// when deriving Debug on an empty enum

#[derive(Debug)]
enum Void {} //~ WARN never used
enum Void {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is to verify that this doesn't emit a warning due to derive.

@totsteps
Copy link
Member

Ping from triage, @matthewjasper can you please review this.

@estebank any updates after RalfJung last comment.

Thanks.

Copy link
Contributor

@matthewjasper matthewjasper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with comments addressed

src/test/ui/lint/lint-dead-code-unused-variant-pub.rs Outdated Show resolved Hide resolved
src/test/ui/lint/lint-dead-code-empty-unused-enum-pub.rs Outdated Show resolved Hide resolved
@estebank
Copy link
Contributor Author

@bors r=matthewjasper

@bors
Copy link
Contributor

bors commented Aug 26, 2019

📌 Commit 7def99a has been approved by matthewjasper

@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 Aug 26, 2019
Centril added a commit to Centril/rust that referenced this pull request Aug 26, 2019
Do not complain about unused code when used in `impl` `Self` type

Fix rust-lang#18290.
bors added a commit that referenced this pull request Aug 27, 2019
Rollup of 6 pull requests

Successful merges:

 - #63317 (Do not complain about unused code when used in `impl` `Self` type)
 - #63693 (Fully implement or-pattern parsing)
 - #63836 (VxWorks does not provide a way to set the task name except at creation time)
 - #63845 (Removed a confusing FnOnce example)
 - #63855 (Refactor feature gates)
 - #63921 (add link to FileCheck docs)

Failed merges:

r? @ghost
@bors bors merged commit 7def99a into rust-lang:master Aug 27, 2019
@estebank estebank deleted the dead-code branch November 9, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spurious dead code warning when item is only used in impls
6 participants