2 min

Rust 2021 is scheduled for release in October, with new insights from the Rust team revealing what to expect. Rust 2021 is the third edition of the language. The way the team releases it is, leverages opt-in updates that introduce features without backward compatibility.

For developers, the changes are not involuntary. Unless they shift to the new edition, they will not see the new updates or changes.

The Rust team says that crates in one edition are interoperable with crates compiled in previous editions. With this feature, the decision to migrate to an updated edition is left in the hands of users.

The new changes

The updated edition comes with a new prelude (a module that contains the automatically imported things in every module). The addition of traits to the prelude breaks the existing code. However, there is a workaround in Rust 2021, since the prelude comes with three additions.

They are: std::convert::TryInto, std::convert::TryFrom, and std::iter::FromIterator..

The edition also introduces a small workaround to Intolterator, which causes breaks in the existing current code. The Rust team explains that older editions need some hacks to function properly in places but the new edition makes most of the hacks unnecessary.

What else is new

Rust 2021 will bring a feature resolver, meaning that all requested features in crates, that are dependencies, are no longer merged. The new edition closures, which automatically capture what’s referred to within their body, will now only capture fields they actually use.

The new panic! () macro will be more consistent and will not accept arbitrary expressions as the only argument.

Some of the syntax in this new edition is reserved (prefix#identifier, prefix”string”, prefix’c’, and prefix#123) to make room for new syntax later. Only time and usage will tell if these changes are liked by developers. Find out more about Rust 2021 from the official Rust site.