gccrs: Add walker for unconstrained type parameters in const generics
Adds a walker to gccrs to handle unconstrained type parameters in const generics, fixing Rust-GCC/gccrs#4805.
This commit introduces a walker for unconstrained type parameters within const generics in the gccrs compiler. This change addresses an issue where these parameters were not being properly handled, leading to incorrect behavior. A new test case, issue-4805.rs, is included to verify the fix.
In Details
The gccrs compiler's type-checking infrastructure needed an update to correctly traverse and constrain type parameters in constant generics. This patch adds the walk_type_to_constrain function in rust-hir-type-check-base.cc to handle these unconstrained parameters, ensuring that Rust's const generics are processed accurately within the GCC toolchain.
- const generics
- A Rust feature allowing generic parameters to be constants, enabling more expressive and performant code by enabling compile-time evaluation of generic values.
- type parameters
- Placeholders in generic code that represent specific types. In const generics, these parameters can also be constant values.
- unconstrained type parameters
- Type parameters in Rust that do not have any trait bounds or other constraints specified, meaning they can be any type that satisfies the overall generic context.