Skip to content

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

Closed

Description

@scurest

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!(),

Activity

  1. oli-obk commented on Feb 3, 2016

    @oli-obk
    Contributor

    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.

  2. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Jun 17, 2016
  3. oli-obk commented on Jan 26, 2017

    @oli-obk
    Contributor

    does not ice anymore, but reports a normal error

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

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions