gccrs: Handle FUNCTION segments in new_type_param
Compiler now correctly processes FUNCTION segments for type parameters.
The gccrs compiler has been updated to correctly handle FUNCTION segments within new_type_param. Previously, these segments were not supported, leading to errors. This change ensures that FUNCTION segments are processed using reconstruct(), preventing the compiler from hitting unreachable code paths and resolving Rust-GCC/gccrs#3939.
In Details
The Builder::new_type_param function in gccrs now correctly handles FUNCTION segments, which arise from Fn, FnMut, and FnOnce bounds. Instead of erroneously calling rust_unreachable!, these segments are now processed using reconstruct(), aligning with the expected AST construction for function types. This resolves an issue where certain valid Rust function types could not be processed.
- FUNCTION segment
- A representation of function types in Rust's type system, specifically for callable entities like Fn, FnMut, and FnOnce traits.
- new_type_param
- A function within gccrs responsible for building new type parameters, likely part of the Abstract Syntax Tree (AST) construction process.
- reconstruct()
- A method likely used in AST or type system manipulation to rebuild or represent a type or structure, ensuring its validity and completeness.