inko-lang / inko

A language for building concurrent software with confidence

Home Page:http://inko-lang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moving a variable in a loop followed by an unconditional break crashes the compiler

yorickpeterse opened this issue · comments

Please describe the bug

The following code crashes the compiler:

class async Main {
  fn async main {
    let mut nums = [10, 20]

    loop {
      let x = nums
      break
    }
  }
}

The error is as follows:

thread 'main' panicked at compiler/src/mir/passes.rs:4246:9:
missing state for register r14 in block b3 (method "main" in "/var/home/yorickpeterse/Downloads/test.inko")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Please list the exact steps necessary to reproduce the bug

Create test.inko as follows:

class async Main {
  fn async main {
    let mut nums = [10, 20]

    loop {
      let x = nums
      break
    }
  }
}

Then run inko check test.inko.

Operating system

Arch Linux

Inko version

main

Rust version

1.74.1