gccrs: Add missing lifetime handling to trait resolve
Compiler now correctly handles lifetimes during trait resolution.
gccrs has been updated to include missing lifetime handling during trait resolution, addressing Rust-GCC/gccrs#4912. The TraitResolver::resolve_trait function in rust-hir-trait-resolve.cc now correctly accounts for lifetimes, ensuring more robust and accurate trait resolution. A new test case has been added to verify this fix.
In Details
The TraitResolver::resolve_trait function in gccrs now correctly incorporates lifetime analysis during trait resolution. This change ensures that lifetime parameters and elision rules are properly considered when resolving traits, preventing potential errors in code that relies on lifetime annotations. This is crucial for correctly implementing Rust's borrow checker semantics within the compiler.
- Lifetime
- In Rust, a lifetime is a scope for which a reference is guaranteed to be valid. The compiler uses lifetimes to prevent dangling references.
- Trait Resolution
- The process in Rust where the compiler determines which implementation of a trait applies to a given type or context. This involves matching trait bounds and associated types.
- TraitResolver
- A component within gccrs responsible for implementing the logic to resolve trait-related information during compilation.