Skip to content

Seemingly incorrect error about use of uninitialized value #7508

Closed
@DaGenix

Description

@DaGenix

The following program:

fn test() -> (u32, u32) {
    return (0, 0);
}

fn main() {
    let mut X0: u32;
    let mut X1: u32;
    (X0, X1) = test();
}

Gives me the error:

multi-bind-issue.rs:9:5: 9:7 error: use of possibly uninitialized variable: X0
multi-bind-issue.rs:9 (X0, X1) = test();
^~
multi-bind-issue.rs:9:9: 9:11 error: use of possibly uninitialized variable: X1
multi-bind-issue.rs:9 (X0, X1) = test();
^~
error: aborting due to 2 previous errors

Which seems wrong, since the use its complaining about is the initialization of the variables.

Compiled with: 8883099

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions