MMS • RSS
The first release of Rust 2018, corresponding to Rust 1.31, will be ready on December 6 2018, writes the Rust Core Team, consolidating under a new label the wealth of new features that have enriched the language since Rust 2015 was first delivered.
As InfoQ reported, Rust 2018 is mostly about improving the language productivity, which means focusing on compiler performance, polishing a number of language features, and further advancing tooling, libraries, and documentation. New Rust 2018 language features have been surfacing in recent Rust releases or will appear in the next releases leading to Rust 1.31, including
impl Trait, macros 2.0, SIMD support, generators, non-lexical lifetimes, async/await support, and a modules revamp.
Most notably, Rust 2018 is going to relax a bit its stability guarantee in favour of language changes that could break existing Rust 2015 code. For example, Rust 2018 is going to include the
try keyword, which could conflict with a function or variable name in some code.
To address this and similar possibilities and help developers manage the transition from Rust 2015 to Rust 2018, Rust is going to follow in the steps of C++ and Java. This has several implications:
Rust 2018 will be opt-in. If you want to use Rust 2018 in an existing project, you can add
edition = '2018'to your project
cargo.toml. In case the
editionkey is missing, the Rust compiler will default to using Rust 2015. All new projects created using
cargo newwill have
edition = '2018'by default.
Since the Rust compiler will be able to support both Rust 2015 and 2018, you will be able to mix in the same project dependencies using either of Rust editions without problems. This will enable using a Rust 2015 dependency in a Rust 2018 program, as well as using a Rust 2018 dependency in a Rust 2015 project.
The language core will remain the same, meaning Rust 2018 will only include surface-level breaking changes, such as the aforementioned
trykeyword, or a number of warnings converted into errors, etc.
Additionally, Rust 2018 will include a new tool,
cargo fix, which will help developers convert existing code bases and gradually transition their code to adopt new features and idioms that Rust 2018 prefers.
On a related note, the Rust Core Team has recently released Rust 1.28, which introduces global allocators, which allows developers to provide their own memory allocators to be used instead of the system allocator; the
NonZero number type, which enables memory optimizations; and improved error messages and formatting.