Skip to content

MIR borrowck: errors unreported in unreachable arms of match expressions #45043

Closed
@zilbuz

Description

@zilbuz

Note from @pnkfelix for people looking at this bug: See important soundness issue in ariel's issue.

In the following code the borrow error in the z arm isn't reported with MIR borrowck, but it is reported with AST borrowck:

fn main() {
    let mut x = 1;
    let _x = &mut x;
    match x {
        y => println!("y: {}", y), // Error in AST and MIR
        z => println!("z: {}", z), // Error only in AST
    }
}

(compile with -Z emit-end-regions -Z borrowck-mir to use the MIR borrowck)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions