GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Gate `cfg_select!` macro behind `-frust-compat-version=1.90`

gccrs restricts `cfg_select!` macro availability based on the Rust compatibility version flag.

GCC’s Rust front-end (gccrs) now conditionally enables the cfg_select! macro based on the -frust-compat-version=1.90 compiler flag. This commit updates the macro resolution logic and test cases to reflect this gating, ensuring that the macro is only available when explicitly requested through the compatibility version setting.

In Details

This commit refines the integration of the cfg_select! macro within gccrs by gating its availability based on the -frust-compat-version session flag. Specifically, the Early::visit(MacroInvocation) and MacroExpander::expand_invoc functions now conditionally resolve cfg_select! only if the session's compatibility version meets or exceeds 1.90. Test cases are also updated to align with this new behavior, removing prior workarounds for the macro's availability.

For Context
cfg_select!
A Rust macro that allows conditional compilation based on cfg (configuration) attributes. It selects one of several blocks of code to expand based on matching predicates.
-frust-compat-version
A compiler flag in gccrs that specifies the Rust compatibility version to adhere to. Setting it to 1.90 enables features and behaviors from that Rust version.
MacroInvocation
An AST node or internal representation in gccrs that represents a call to a macro.
MacroExpander
A component within gccrs responsible for the actual process of expanding macros into code.
AST
Abstract Syntax Tree. A tree representation of the source code's structure, used by the compiler for analysis and transformation.
Filed Under: gccrscompilermacrocompatibility