Mir: Refactor calls to permit calls that cannot panic and to better accommodate calls that always panic #29767
Labels
A-MIR
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
I-needs-decision
Issue: In need of a decision.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Today, calls are always basic block terminators. This is unnecessary for calls that cannot panic. We might consider adding a call rvalue. The plus side is that it permits fewer basic blocks and in particular permits avoiding the unwinding code. The minus side is that it means more than one way for a call to happen.
Another thing is that calls today always have two successors. But for fns of type
-> !
, they never return normally, so they should only have a panic successor.It might be better to leave calls as always being terminators, but just have the number of successors be either 1 or 2. If the number of successors is 1, then the fn is either diverging (
-> !
), in which case this is a panic successor, or else it means the fn is known not to panic somehow.cc @Aatch you were mentioning this
The text was updated successfully, but these errors were encountered: