March 24th, 2025

Rust Additions for GCC 15 Bring Support for If-Let Statements

Recent updates to GCC 15.1's Rust front-end include support for "if let" statements, improved AST and HIR handling, full implementation of Clone and Copy traits, and upcoming PartialOrd and PartialEq support.

Read original articleLink Icon
Rust Additions for GCC 15 Bring Support for If-Let Statements

Recent updates to the Rust front-end for GCC 15.1 have introduced significant enhancements, including support for "if let" statements and improvements to the Polonius borrow checker. A total of 146 patches were merged, with notable changes to the Abstract Syntax Tree (AST) and High-Level Intermediate Representation (HIR) to better accommodate Rust's lang-item paths. These modifications allow for easier reference to essential Rust items during compilation. The updates also include the full implementation of the Clone and Copy traits, with additional built-in derive macros expected in future patches. Furthermore, support for PartialOrd and PartialEq traits is anticipated to be integrated before the stable release. The ongoing improvements aim to enhance the practicality of the gccrs front-end as a viable alternative to Rust's official LLVM-based compiler, rustc. The latest patchset also addresses various type-system and testsuite fixes, particularly for systems with different endianness, contributing to the overall stability and functionality of the compiler.

- GCC 15.1 introduces support for Rust's "if let" statements and other enhancements.

- Significant changes to AST and HIR representations facilitate better lang-item path handling.

- Full implementation of Clone and Copy traits has been achieved, with more macros to follow.

- Support for PartialOrd and PartialEq traits is expected before the stable release.

- Improvements aim to make gccrs a practical alternative to the official Rust compiler.

Link Icon 3 comments
By @Corrado - about 1 month
This sounds like good progress for getting Rust into more places. I had no idea that this type of thing was not supported in Rust-GCC.

BTW: Here's a good reference to the differences between "if" and "if let" - https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/sh...

By @pjmlp - about 1 month
On a side note, gccgo seems to be on the route to follow gcj footsteps removal from GCC, left to stagnate on 1.18 version without any clear roadmap if it will ever be touched again other than minor bug fixes.

Kind of ironic now with Cobol being added in GCC 15, joining Modula-2, D, Rust, Fortran, Ada, C, C++ collection of frontends.