Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct Deconstruct with cfg is reported as erroneous #16169

Closed
niko-renko opened this issue Dec 20, 2023 · 1 comment · Fixed by #16427
Closed

Struct Deconstruct with cfg is reported as erroneous #16169

niko-renko opened this issue Dec 20, 2023 · 1 comment · Fixed by #16427
Assignees
Labels
C-bug Category: bug

Comments

@niko-renko
Copy link

niko-renko commented Dec 20, 2023

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

@niko-renko niko-renko added the C-bug Category: bug label Dec 20, 2023
@Young-Flash
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants