Skip to content

mut qualifier cannot be applied to closure arguments #6153

Closed
@nikomatsakis

Description

@nikomatsakis

The following example should parse and work correctly:

fn swap(f: &fn(~[int]) -> ~[int]) -> ~[int] {
    let x = ~[1, 2, 3];
    f(x)
}

fn main() {
    let v = swap(|mut x| { x.push(4); x });
    let w = do swap |mut x| { x.push(4); x };
    assert_eq!(v, w);
}

It does not parse now (mut in identifier position)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of Rust

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions