Skip to content

Use of uninitialized variable after pattern error #60350

Closed
@matthewjasper

Description

@matthewjasper

The following code reports a warning that x is uninitialized as well as the expected pattern error.

fn destructure_slice(s: &[i32]) {
    let [x] = *s;
    drop(x);
}

playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.fixed-by-NLLBugs fixed, but only when NLL is enabled.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions