Rust GCC Is Official
Written by Harry Fairhead   
Wednesday, 13 July 2022

Rust, the language we all like to consider using, is about to be even more difficult to avoid. The GCC Steering Committee has just voted to approve the contribution of the Rust Frontend to the GCC.

Rust Use Continues To Increase

Why is this important?

GCC, the GNU Compiler Collection, is the "standard" compiler set for Linux. It is standard in the sense that Linux itself is compiled using it. It is also standard in that if you plan to create a program for Linux, or for an embedded device, then your first thought is generally GCC. You could say that only adventurous programmers consider alternatives such as LLVM - it has advantages. However, the Rust compiler is LLVM and hence there is a slight resistance to moving to Rust.

You can mix LLVM and GCC as there is a backend for GCC  that uses the output of LLVM to generate the code, but it is still not smooth from the point of view of the programmer and there are security considerations. There is no question that the ideal situation would be to have Rust as just one of the supported languages in the GCC toolchain. Work on this started back when Rust was still unstable at version 0.9 and now that Rust is stable it has reached the point where it can be included in GCC:

"Congratulations! The GCC Steering Committee has voted to accept the contribution of the Rust Frontend (aka GCC Rust) to GCC. Please work with the GCC Global Reviewers and GCC Release Managers for technical review and technical approval of the patches. We look forward to including a preliminary, beta version of GCC Rust in GCC 13 as a non-default language."

GCC 13 is currently in an early stage of developement and should be released around May 2023.

There are some interesting problems, however. The strangest is that currently Rust doesn't have a formal specification, which is suprising given that it is an advanced language pushing practice and theory forward:

"Rust currently lacks a full language specification. The Ferrocene project by Ferrous Systems (https://ferrous-systems.com/blog/sealed-rust-the-pitch/) is the first step in that direction. If Rust-GCC can help with that, we're happy to work together and move the formal specification forward.

Until this happens, rustc and The Rust Reference will be used as the Rust-GCC development specification"

This means that there are likely to be divergences between the GCC and LLVM.

"If gccrs interprets a program differently from rustc, this is considered a bug."

This should be helpful to standardising Rust as it will force inconsistencies out of the system.

Then there is the question of the borrow checker which is a key part in making Rust safe. At the moment there isn't a GCC borrow checker and this is a big drawback. There are plans to adapt an existing checker, but no timeline for this to be achieved.

Then we have the final problem of build systems. The Rust module system is very different from C/C++ and until a build system is adapted working with large Rust programs is going to be a problem.

So the bottom line is that it is all encouraging, but there is still a long way to go.

 rustgcc

More Information

Rust front-end

https://github.com/Rust-GCC/gccrs

Related Articles

Rust Gets Into The Kernel

Rust Adds Source-based Code Coverage

Amazon AWS Invests In Rust

Rust Lang Releases 2024 Roadmap

Rust 1.50 Improves Array Indexing

Rust Fast And Safe

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


AI Propels Python To Top Language on GitHub
30/10/2024

This year's Octoverse Report reveals how AI is expanding on GitHub and that Python has now overtaken JavaScript as the most popular language on GitHub. The use of Jupyter Notebooks has also surged.



OpenAI Library For .NET Exits Beta
19/11/2024

A few months ago the OpenAI .NET library was released as a beta. It has now reached version 2.0.0 and the time has come to leave beta and, with a few amendments enter production readiness.


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

 

Last Updated ( Wednesday, 13 July 2022 )