Skip to content

Field accesses in debuginfo are treated as real uses of the base local #77454

Closed
@jonas-schievink

Description

@jonas-schievink

MIR may contain debuginfo like this after inlining:

    scope 1 {
        debug x => _3;                   // in scope 1 at $DIR/inline-closure-captures.rs:11:9: 11:10
        scope 2 {
            debug _q => _10;             // in scope 2 at $DIR/inline-closure-captures.rs:11:14: 11:16
            debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline-closure-captures.rs:10:23: 10:24
            debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline-closure-captures.rs:10:17: 10:18
            let mut _9: T;               // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
        }
    }

Here, the field access (*_6).0 is treated like a use of the _6 local in MIR visitors (using PlaceContext::NonMutatingUse), even though it is not an actual use of _6.

Instead, it should be using PlaceContext::NonUse(NonUseContext::VarDebugInfo).

Metadata

Metadata

Assignees

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.)A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.T-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