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.
- 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
gccrsthat specifies the Rust compatibility version to adhere to. Setting it to1.90enables features and behaviors from that Rust version. - MacroInvocation
- An AST node or internal representation in
gccrsthat represents a call to a macro. - MacroExpander
- A component within
gccrsresponsible 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.