I'm getting a panic message from the compiler.
thread '<unnamed>' panicked at 'constructor must be known in the indexable type if we are exhautiveness checking', crates/compiler/can/src/exhaustive.rs:211:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Usually the compiler points me in the general direction of the problem, so I was surprised by this. Obviously there is an issue with my code and I'll work on troubleshooting it to figure out what caused it, but I wondered if this is a known panic scenario and if it could get caught and provide some more user friendly feedback from the compiler instead?
I seem to have found the issue. A when x is
pattern match didn't have all possibilities and adding an _ ->
branch is now getting me useful compiler errors again. It's strange since I'm certain I've gotten missing possibility errors previously when pattern matching like that, so I'm not sure what was different this time.
this definitely looks like a compiler bug!
if there's a way you could reproduce it, that would be helpful to narrowing down what the problem is
I can reproduce it now, but it's got a fair amount of supporting code. Let me see if I can get a simpler reproduction.
appreciate it, thank you! :heart:
Here's the issue: https://github.com/roc-lang/roc/issues/6594
Basically, I had two exhaustiveness issues and the combination caused the problem. Fixing either one allows the compiler to give normal error messages again.
I don't know how hard it would be to detect and give a compiler error instead of a panic, but it's reported now in any case.
Last updated: Jul 05 2025 at 12:14 UTC