Skip to content

Renaming variables declared by destructuring causes destructuring pattern to become invalid #6551

@Veykril

Description

@Veykril
struct Foo {
    i: i32,
}

fn foo(foo: Foo) {
    let Foo { i } = foo;
    let _ = i<|>;
}

renaming i to bar here gives:

struct Foo {
    i: i32,
}

fn foo(foo: Foo) {
    let Foo { bar } = foo;
    let _ = bar;
}

which is incorrect as Foo has no bar field. Instead it should be Foo { i: bar }.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions