ICE with pattern guards #2869

catamorphism opened this Issue Jul 11, 2012 · 3 comments


None yet

2 participants


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.


We ran into a similar patterning ICE during ICFP (#2928), when doing disjunctive patterns with different variable names, I think? (i.e., "foo(a) | bar(b) { .. }") efaust determined the code was incorrect and the compiler should've errored, and it won't ICE on correct code.

Hopefully related. Tarball forthcoming.


If it doesn't ICE on correct code, then you found a different bug, because the code above is correct.

@catamorphism catamorphism was assigned Nov 24, 2012

This is indeed a dup of #3121.

@catamorphism catamorphism removed their assignment Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment