Warn on assert!(always_false) #73435
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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
:The text was updated successfully, but these errors were encountered: