Skip to content

Allow *local* mutation and assignments in pattern guards #23627

Closed
@Stebalien

Description

@Stebalien

Due to #15989, it isn't possible to assign/mutate in pattern guards. However, assignment/mutation of variables local to the pattern guard should be perfectly safe.

As reported on reddit: https://pay.reddit.com/r/rust/comments/2ztiag/cannot_mutably_borrow_in_a_pattern_guard/ by qthree:

This code is failing: http://is.gd/cAYb5r But that's ok: http://is.gd/7pF28q

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