Skip to content

ICE with pattern guards #2869

Closed
Closed
@catamorphism

Description

@catamorphism

This code causes an ICE in trans::alt::compile_submatch (where it calls option::get):

enum pat { pat_ident(option<uint>) }

fn f(pat: pat) -> bool { true }

fn num_bindings(pat: pat) -> uint {
    alt pat {
      pat_ident(_) if f(pat) { 0 }
      pat_ident(none) { 1 }
      pat_ident(some(sub)) { sub }
    }
}

fn main() {}

I've tried to fix it, but I just don't understand the code that compiles pattern matches. Comments would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions