Skip to content

MIR SourceScopes stay around even when all their uses were removed. #68964

Open
@eddyb

Description

@eddyb

We already have a testcase, namely simplify_try, which replaces enough of the original body to make some SourceScopes 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 SourceScopes 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-enhancementCategory: An issue proposing an enhancement or a PR with one.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions