Open
Description
We already have a testcase, namely simplify_try
, which replaces enough of the original body to make some SourceScope
s unused.
However, despite no statements/terminators using those scopes anymore, they stick around.
The fact that they're gone is in itself a problem (debuginfo is lost, see comments on #66282), but we could argue that SourceScope
s only used in unreachable code should still be removed, e.g.:
if false {
let x = 123;
}
There is no reason to have debuginfo for x
tracked anywhere once the x = 123;
block is removed.
@rust-lang/wg-mir-opt