Skip to content

borrowck does not distinguish between "argument" and "local variable" anymore #24114

Closed
@Swatinem

Description

@Swatinem

The following example:

fn foo(v: Vec<u32>) {
    v.push(4);
}

fn main() {
    foo(vec![1, 2, 3]);
}

generates the following error:

mut.rs:2:5: 2:6 error: cannot borrow immutable local variable `v` as mutable
mut.rs:2     v.push(4);
             ^

A few month ago, it used to say "argument" instead of "local variable".

I already found the code that does this, still need to figure out how to fix it, give me a few days :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions