Modifying a single subpattern in match changes MIR dramatically #92766
Labels
A-MIR
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This is originated from
~const Drop
, but is applicable to non-const functions as well. The problem is best seen as the MIR output for two implementations ofResult::ok
with a minor change: (play)I won't post the whole MIR output here, but let me illustrate this issue with a handwritten control flow graph:
wildcard
is unexpectedly more complex and performsswitchInt
onx
for two times instead of one. I think ideally we should always generate MIR as the second graph.See #92433 (comment) and Zulip
The text was updated successfully, but these errors were encountered: