Skip to content

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

Closed
@arielb1

Description

@arielb1
Contributor

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @arielb1

        Issue actions

          MIR borrowck: the value of an assignment statement is uninitialized · Issue #46159 · rust-lang/rust