gccrs: Fix unconstrained check to look for constrained bindings
Type checker now correctly identifies constrained bindings.
A fix in gccrs ensures the unconstrained check correctly identifies constrained bindings, addressing Rust-GCC/gccrs#4911. The walk_type_to_constrain function in rust-hir-type-check-base.cc has been modified to properly traverse and consider binding arguments. This correction improves the accuracy of type checking, especially in complex generic scenarios.
In Details
The walk_type_to_constrain function in gccrs's rust-hir-type-check-base.cc has been updated to correctly handle constrained bindings within type checking. It now properly walks binding arguments, ensuring that the type checker accurately identifies and processes constraints on generic parameters. This resolves an issue where unconstrained checks might incorrectly succeed when actual constraints were present.
- Constrained binding
- In Rust's type system, a binding (like a generic parameter) that has associated trait bounds or other constraints specifying its valid forms.
- Type checking
- The process by which a compiler verifies that the types of expressions, function calls, and other language constructs are used correctly according to the language's type rules.
- HIR (High-level Intermediate Representation)
- An intermediate representation used in compilers like gccrs that is closer to the source language's structure than lower-level IRs, facilitating semantic analysis and type checking.