-
Notifications
You must be signed in to change notification settings - Fork 13.3k
dead_code warnings are wrong #18618
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
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
Comments
Do you have an example? |
static A: u8 = 1;
fn f() { A; }
fn main() { }
|
A is never used in that case, though. |
|
The dead code warning is transitive by design: fn foo() {}
fn bar() {
foo()
}
fn main() {}
|
There are two desired properties of the dead code lint that it would ideally exhibit:
Unfortunately, it is impossible to satisfy both so we're choosing 2) over 1). I'm not sure it's the right choice. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In some cases, removing this dead code will cause an error.
The text was updated successfully, but these errors were encountered: