Closed
Description
A friend was teaching me Rust and showing me the distinction between return
and the value of an expression, and when I tried to put a return
in a top level const
, we got a panic.
Here's a minimal reproducing case.
const x: () = {
return;
};
fn main() {}
Fails with:
rustc 1.13.0 (2c6933acc 2016-11-07)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'assertion failed: match self.hir.tcx().region_maps.code_extent_data(self.scopes[1].extent) {
CodeExtentData::ParameterScope { .. } => true,
_ => false,
}', ../src/librustc_mir/build/scope.rs:435
note: Run with `RUST_BACKTRACE=1` for a backtrace.