Distinguish generics and const-generics during binding in gccrs
gccrs now correctly differentiates between generic and const-generic parameters during trait binding.
gccrs has improved its trait resolution logic to distinguish between regular generics and const-generics when binding implementations. This ensures that trait implementations are correctly associated with the appropriate generic or const-generic parameters, resolving issues related to Rust-GCC/gccrs#4812. A new test case has been added to verify this functionality.
In Details
This change impacts AssociatedImplTrait::bind_impl_for_projection and AssociatedImplTrait::bind_impl_for_bound within gccrs' trait resolution system. It introduces logic to differentiate between type parameters (generics) and const parameters (const-generics) during the process of finding a matching trait implementation for an associated type projection or bound. This is critical for correctly resolving generic and const-generic associated items.
- generics
- A feature in programming languages that allows code to be written to work with types that are specified later. In Rust, these are often denoted by angle brackets, e.g.,
Vec<T>. - const-generics
- An extension to Rust's generics that allows generic parameters to be values of certain constant types (e.g., integers, booleans), enabling more compile-time computations and static configurations.
- trait resolution
- The compiler process of determining which specific implementation of a trait should be used for a given type or context. This involves matching trait bounds and generic parameters.