Skip to content

Unboxed closures can mutate captures of immutable variables #18335

Closed
@bkoropoff

Description

@bkoropoff

Example that shouldn't compile:

#![feature(unboxed_closures)]

fn main() {
    let x = 0u;
    move |&mut:| x = 1;
}

Note that this currently ICEs due to #18238, but it's still a problem once that is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions