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 const-evaling a block that does not end with an expression #31384

Closed
scurest opened this issue Feb 3, 2016 · 2 comments
Closed

ICE when const-evaling a block that does not end with an expression #31384

scurest opened this issue Feb 3, 2016 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@scurest
Copy link

scurest commented Feb 3, 2016

Unreachable code is entered when trying to const-eval a block that doesn't have a terminating expression.

const fn f(_: ()) -> usize { 1 }
fn main() {
    [0; f({})];
}

The relevant line is

None => unreachable!(),

@oli-obk
Copy link
Contributor

oli-obk commented Feb 3, 2016

That was me! I found no way to trigger this so I made it unreachable, but I forgot about const fn arguments. We don't have a way of creating a unit constant. Technically it would be an empty tuple, but our constant tuples are just an expression id, we can't create new ones in the const evaluator.

oli-obk added a commit to oli-obk/rust that referenced this issue May 11, 2016
@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 17, 2016
@oli-obk
Copy link
Contributor

oli-obk commented Jan 26, 2017

does not ice anymore, but reports a normal error

@scurest scurest closed this as completed Jan 26, 2017
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