Skip to content

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

Closed
@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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions