GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Fix ICE in path pattern refutability

Resolves an internal compiler error when determining the refutability of path patterns.

This commit fixes an internal compiler error (ICE) in gccrs’s handling of path pattern refutability. Previously, PathPattern::is_refutable looked up paths using only the last segment’s HIR ID, which did not correctly identify the item. This caused let bindings and function parameters to hit a rust_unreachable error. The fix now resolves paths through name resolution, correctly identifying constants as refutable and falling back to the scrutinee type for others.

In Details

The PathPattern::is_refutable method in gcc/rust/hir/tree/rust-hir-pattern-abstract.cc was modified to resolve paths via name resolution instead of relying solely on the last segment's HIR ID. This corrects issues with associated constants and const generics, ensuring that constants are correctly identified as refutable and other path types fall back to the scrutinee type, preventing rust_unreachable errors.

Filed Under: rustcompilerpattern matchingICE