Rust programming language: Here are the changes planned for this year

Next big update to Rust programming language is coming in October.
Written by Liam Tung, Contributing Writer

The team behind Rust has announced plans to release the third edition of Rust, a programming language that's getting attention from Microsoft, Amazon Web Services, Google, Facebook, Mozilla, and Huawei. 

The system programming language is desired for its memory safety guarantees and is being eyed as a replacement for code written in C/C++. 

Rust isn't widely used yet but developers really like the language and it's getting backing from tech giants. Google is even pushing for Rust to become a second language for drivers in the Linux kernel to reduce memory-related security bugs. 

SEE: Hiring Kit: Python developer (TechRepublic Premium)

The Rust team has announced the Rust "2021 edition" should be available in October, which promises to "make a significant improvement to how Rust feels in practice." It follows on from the Rust 2015 and Rust 2018 editions. 

Some reasons Rust is popular among developers is because the project listens to developers and makes changes that are friendly to them and it's got a developer-friendly Rust compiler.  It's also fast like C++ and doesn't require a runtime or garbage collector.  

While there are some upcoming breaking changes, the team is aiming to minimize the impact of language changes. It explains in a blogpost that editions such as the upcoming 2021 edition are designed to handle backwards compatibility issues with Rust code. 

"Editions are the mechanism we use to solve this problem. When we want to release a feature that would otherwise be backwards incompatible, we do so as part of a new Rust edition," explains Mara Bos, an electronics engineer and Rust contributor.  

Rust reached version 1.0 in 2015 and has become popular for system programming. It was hatched at Mozilla but is an open-source project. Extensions are handled by way of Rust's Cargo package manager, which offers Rust developers 'crates' or add-ons, much like the libraries that Python developers can use to extend the capabilities of the language. 

"Editions are opt-in, and so existing crates do not see these changes until they explicitly migrate over to the new edition," adds Bos.  

Bos flags a new keyword in Rust as one occasion where the volunteer-backed project believes it's valuable to introduce a change that's not backwards compatible because they invalidate variables with the same name. Hence the use of editions.

"This means that even the latest version of Rust will still not treat async as a keyword, unless edition 2018 or later is chosen. This choice is made per crate as part of its Cargo.toml. New crates created by cargo new are always configured to use the latest stable edition," she explains. 

"Our goal is to make it easy for crates to upgrade to a new edition. When we release a new edition, we also provide tooling to automate the migration. It makes minor changes to your code necessary to make it compatible with the new edition," adds Bos.  

The team also provides an Edition Migration Guide to help developers be aware of small changes that could cause problems.  

SEE: Programming languages: JavaScript has most developers but Rust is the fastest growing

Rust 2021 introduces a new "prelude" within the Rust standard library to address situations where adding a trait to the prelude can break existing code.

It also brings a new default Cargo feature resolver, the IntoIterator for arrays, disjoint capture in closures, panic macro consistency, and reserves syntax. 

Bos warns that the voluntary nature of the Rust project means it might not make the October target. 

"Our plan is to have these changes merged and fully tested by September, to make sure the 2021 edition makes it into Rust 1.56.0. Rust 1.56.0 will then be in beta for six weeks, after which it is released as stable on October 21st," writes Bos.

"However, note that Rust is a project run by volunteers. We prioritize the personal well-being of everyone working on Rust over any deadlines and expectations we might have set. This could mean delaying the edition a version if necessary, or dropping a feature that turns out to be too difficult or stressful to finish in time."

Updated to clarify that this announcement was made by the Rust 2021 Edition Working Group team rather than the Rust Foundation.

Editorial standards