Skip to content

MIR-borrowck: immutable unique closure upvars can be mutated #46023

Closed
@arielb1

Description

@arielb1

MIR borrowck allows for immutable unique closure upvars to be mutated, e.g.

fn main() {
    let x = 0;

    (move || {
        x = 1; // mutating immutable local, ok on MIR, bad on AST
    })()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions