The Rust 2021 Edition working group is happy to announce that the next edition of Rust, Rust 2021, is scheduled for release later this year. While the RFC formally introducing this edition is still open, we expect it to be merged soon. Planning and preparation have already begun, and we're on schedule!
If you're curious what features Rust 2021 will introduce or what the timeline for getting the edition released on stable is, keep reading!
What's included in this edition?
The final list of features for inclusion in Rust 2021 is still being decided. Overall, we aim for Rust 2021 to be a much smaller release than Rust 2018. This is for several reasons:
The Rustic Confectionery
Rust is an aggressively competitive survival game that thrives on conflict and trash talk. Other games are better at the individual components, like DayZ for the tense player interactions, Fortnite. Rust is a multi-paradigm programming language designed for performance and safety, especially safe concurrency. Rust is syntactically similar to C, but can guarantee memory safety by using a borrow checker to validate references. Rust achieves memory safety without garbage collection, and reference counting is optional. Rust is the common name for iron oxide. The most familiar form of rust is the reddish coating that forms flakes on iron and steel (Fe 2 O 3), but rust also comes in other colors including yellow, brown, orange, and even green! The different colors reflect various chemical compositions of rust.
Rust's world is harsh. Other players can find you, kill you, and take your stuff. Fortunately for you, you can kill others and take their stuff. The environment is not kind. Wild animals will chase and kill you. Being exposed to radiation for an extended period will kill you. Starvation and exposure will kill you. Rust Programming Language Tutorials. Installation, Hello World, Cargo, Crates, Variable bindings, Functions, Primitive Data Types, Operators & Control Flows.
- establishing a regular cadence for edition releases means we get many of the benefits of Rust's 'train' release model at the edition level.
- Rust 2018 worked directly against the Rust model of 'low stress' releases.
- there's simply fewer breaking changes needed to continue to evolve the language.
You can read more about the evolution of the concept of editions in the RFC.
Whether a feature will be included in Rust 2021 is a part of the RFC process, so the short list of possible features can and will change between now and the edition being released. That being said, here are some of the possible features that may be a part of the edition:
While types and free functions can be added to the prelude independent of edition boundaries, the same is not true for traits. Adding a trait to the prelude can cause compatibility issues because calls to methods named the same as methods of the newly in-scope traits can become ambiguous.
Currently the following traits are being proposed for inclusion in the Rust 2021 edition:
The RFC for this change can be found here. Please note that the RFC is not yet merged, and the contents for a new prelude are still under active discussion.
New closure capture rules
RFC 2229 proposed that closures capture individual fields and not the whole struct when possible. This RFC has been accepted. In some circumstances this change would cause destructors to run at different times than they currently do, so the change must be tied to an edition. Migration lints will be provided to avoid changing the semantics of existing code.
New default feature resolver in Cargo
In Rust 1.51, Cargo will stabilize a new feature resolver which allows a crate's dependencies to use different features in different contexts. For example, a
#[no_std] crate might want to use a particular dependency both as a build dependency (with
std enabled) and as a regular dependency (with
std disabled). Currently, this leads to
std being enabled in both cases since features belong to a global namespace.
In Rust 2021 this new resolver will become the default, but older editions can still use the new resolver by opting into it.
Other proposed changes include unifying how
core work and upgrading several lints from warnings to errors.
You can find a full list of features that are under consideration here.
If you're aware of a feature that has already been under discussion for inclusion in the next edition of Rust but is not listed here, please let us know. While we are excited to hear additional features that have not yet been discussed for inclusion in a Rust edition, we are unlikely to have the bandwidth to discuss such features until after the Rust 2021 edition is ready for release.
So how do we plan on shipping the new edition? Here's a timeline of milestones we're aiming for:
The Rustic Table Redding
- 01 April: All relevant RFCs either merged or in a good state (i.e., all major decisions reached and merging will happen in the following weeks).
- 01 May: All features for inclusion in Rust 2021 are on nightly under feature flags.
- 01 June: All lints are implemented on nightly.
- 01 September: The edition is stabilized on nightly.
- 21 October: The edition hits stable.
As we approach these deadlines, we'll be narrowing down the list of proposed changes to those items that have made active progress.
Call for participation
If you're interested in helping with the 2021 edition release, please get in touch. Besides feature work and edition management planning, there will be plenty of work to do. Some of the additional work items that will need to happen for the edition release include:
rustfixmigrations for all relevant features
- testing all features and their migration paths
- blog posts and other marketing material
Install Rust and Cargo
The easiest way to get Cargo is to install the current stable release of Rustby using
rustup. Installing Rust using
rustup will also install
On Linux and macOS systems, this is done as follows:
It will download a script, and start the installation. If everything goes well,you’ll see this appear:
On Windows, download and run rustup-init.exe. It will start the installationin a console and present the above message on success.
After this, you can use the
rustup command to also install
nightlychannels for Rust and Cargo.
For other installation options and information, visit theinstall page of the Rust website.
Build and Install Cargo from Source
Alternatively, you can build Cargo from source.