Skip to content

Struct Deconstruct with cfg is reported as erroneous  #16169

Closed
@niko-renko

Description

@niko-renko
struct Test {
    #[cfg(feature = "hello")]
    test: u32,
    other: u32
}

fn main() {
    let a = Test {
        #[cfg(feature = "hello")]
        test: 1,
        other: 1
    };

    let Test {
        #[cfg(feature = "hello")]
        test,
        mut other,
        ..
    } = a;

    other += 1;
}

rust-analyzer reports E0559 in deconstruction in the snippet above.

rust-analyzer version: 0.3.1774-standalone

rustc version: 1.74.1 (a28077b28 2023-12-04)

relevant settings: N/A

Metadata

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions