gccrs: Improve bodyless function pattern check
Enhances gccrs's AST validation to catch complex patterns in bodyless functions.
The gccrs compiler has improved its Abstract Syntax Tree (AST) validation to better handle bodyless functions. This commit modifies the AST validation logic to emit an error when complex patterns are used in non-extern bodyless functions. A new test case, function-param-bodyless.rs, has been added to verify this improved checking.
In Details
Enhances ASTValidation::visit(Function) in gccrs's rust-ast-validation.cc. Previously, complex patterns in function parameters were only checked for extern functions. This change extends the check to non-extern bodyless functions as well, preventing potentially invalid constructs from passing through the AST validation stage. A new test case rust/compile/function-param-bodyless.rs is added to cover this scenario.
- AST
- Abstract Syntax Tree. A tree representation of the abstract syntactic structure of source code, used internally by compilers to process and analyze code.
- bodyless function
- In Rust, this typically refers to functions declared without a body, such as function signatures in traits or extern declarations. This commit addresses non-extern declarations that lack a body.
- gccrs
- The Rust frontend for the GCC compiler, aiming to provide a robust and compliant Rust compilation experience within the GCC ecosystem.