Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE when returning from block in const #38458

Closed
a2aaron opened this issue Dec 18, 2016 · 1 comment
Closed

ICE when returning from block in const #38458

a2aaron opened this issue Dec 18, 2016 · 1 comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@a2aaron
Copy link
Contributor

a2aaron commented Dec 18, 2016

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() {}

Playground

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.
@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Dec 19, 2016
@fabric-and-ink
Copy link
Contributor

Seems to be fixed in nightly.

est31 added a commit to est31/rust that referenced this issue Dec 20, 2016
alexcrichton added a commit to alexcrichton/rust that referenced this issue Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants