-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Warn on assert!(always_false) #73435
Copy link
Copy link
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
It would be useful if rustc emitted a warning on assertions when the condition can be statically proven to always be false.
Example:
Currently compiles cleanly without any warnings (playground) — neither about the always false assertion, nor about the unreachable statement.
The LLVM IR emitted:
suggests rustc is able to statically prove the assertion to be always false even before LLVM optimization is run.
I would expect to get something similar to this:
Meta
This is not about any particular version or platform, but here it goes anyway:
rustc --version --verbose: