Skip to content

const_eval: fmt_diff_with copy-paste bug prints qualif instead of borrow #452

Description

@SebTardif

Bug

In compiler/rustc_const_eval/src/check_consts/resolver.rs:310-312, the borrow diff branch prints the wrong field:

if self.borrow != old.borrow {
    f.write_str("borrow: ")?;
    self.qualif.fmt_diff_with(&old.borrow, ctxt, f)?;  // BUG: should be self.borrow
}

The label says "borrow" but the method is called on self.qualif. This is a copy-paste from the qualif diff block above.

Fix

Change self.qualif to self.borrow on line 312.

Impact

Debug-only. Incorrect diagnostic output when inspecting const eval dataflow diffs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalConst evaluationI-wrongWrong result or data corruptionP-lowLow impact: edge case or niche scenariobugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions