Skip to content

MIR borrowck: the value of an assignment statement is uninitialized #46159

Closed
@arielb1

Description

@arielb1

e.g..

fn main() {
    let y;
    &(y = 0);
}

Causes this spurious error:

error[E0381]: borrow of possibly uninitialized variable: `_` (Mir)
 --> ack.rs:3:5
  |
3 |     &(y = 0);
  |     ^^^^^^^^ use of possibly uninitialized `_`

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions