charon_lib::transform

Module duplicate_return

source
Expand description

The MIR uses a unique return node, which can be an issue when reconstructing the control-flow.

For instance, it often leads to code of the following shape:

if b {
  ...
  x = 0;
}
else {
  ...
  x = 1;
}
return x;

while a more natural reconstruction would be:

if b {
  ...
  return 0;
}
else {
  ...
  return 1;
}

Structsยง