Skip to content

Error when initializing struct with cfg field in multiple blocks #3535

@leudz

Description

@leudz

Hi! I have a few structs with fields only present if some feature is set.
Rust-analyzer gives me a missing structure fields error when I initialize the version without all fields.
cargo check doesn't emit any error and it compiles just fine though.
This error only shows up if I use two blocks.

Playground with two blocks
Playground with "inlined" cfg
Whether _field1 is there or not doesn't change anything.

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