GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Ignore bindings on bodyless functions

Compiler now correctly handles parameter names in bodyless functions.

gccrs has been updated to ignore bindings on parameters of bodyless functions, resolving an issue where different parameters could have the same name. The Late Name Resolver now initializes an in_bodyless_params flag and skips visiting patterns of function parameters in bodyless functions. This ensures correct name resolution for functions without bodies, as demonstrated in the new test case multiple_bindings3.rs.

In Details

The Late::Late name resolver in gccrs now correctly handles functions without bodies. It initializes in_bodyless_params and, within visit(FunctionParam), skips processing parameter patterns if the function lacks a body. This prevents incorrect resolution when multiple parameters in a bodyless function share the same name, addressing a subtlety in Rust's name binding rules for such cases.

For Context
Bodyless function
A function declaration in Rust that does not include an implementation body, often used in trait definitions or forward declarations.
Late Name Resolver
A phase in the gccrs compiler's name resolution process that occurs after initial parsing and resolves names and bindings, particularly in the later stages of semantic analysis.
Pattern
In Rust, a pattern is used in various contexts like function parameters, match expressions, and let bindings to deconstruct values and bind names to parts of those values.
Filed Under: gccrsrustname resolution