rustc fails to remove dead panic! code when unwrapping an Option #48253
Labels
A-codegen
Area: Code generation
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider the following code:
The
& 1
ensures the panicking conditions can never happen. This is the corresponding code generated on godbolt with 1.24 beta and 1.25 nightly:Note how
to_color
goes through hoops. But the most notable thing is that this is actually a regression from 1.24, because versions up to an including 1.23 were actually generating the same code for both functions.The text was updated successfully, but these errors were encountered: