Skip to content

Problems with destructuring structs with a path to a submodule #3766

Closed
@erickt

Description

@erickt

Here's a simple example:

mod foo {
    pub struct Foo { foo: int }
}
use foo::Foo;

struct Bar { bar: int }

fn main() {
    let Foo { foo: _foo } = foo::Foo { foo: 1 };
    //let foo::Foo { foo: _foo } = foo::Foo { foo: 1 };
}

This compiles fine, but if you uncomment //let foo::Foo { foo: _foo } = foo::Foo { foo: 1 }; it will error out with:

test.rs:10:17: 10:18 error: expected `;` but found `{`
test.rs:10     let foo::Foo { foo: _foo } = foo::Foo { foo: 1 };
                            ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions