The Rust release team chose US independence day to ship v1.36.0 of the upstart language.
Rust 1.36.0 has been dubbed a “stable” release, with a variety of features now getting the stable moniker. This fits with the community’s previously declared aim of making this year more about rejuvenation and maturation, rather than just shipping features and growing.
So, top of Rust’s own list of changes is the stabilisation of the “future” trait. This is an asynchronous computation, representing a value that may not have finished computing yet. The announcement added, with a touch of mystery, “With this stabilization, we hope to give important crates, libraries, and the ecosystem time to prepare for ‘async / .await’, which we’ll tell you more about in the future.”
The “alloc” crate – which covers memory allocation APIs – has also been declared stable, joining the standard library along “std”, “core” and “pro_macro”. This means that parts of the std crate that required a global allocator are now available in the “alloc” crate.
Also stablised is the “MaybeUninit<T>” type. This is a “safer alternative” to the “mem: :unitialized” function, which allowed the bypass of Rust’s initialization checks, “by pretending that you’ve initialized a value at type T without doing anything…one of the main uses of this function has been to lazily allocate arrays.” This, according to the Rust team was an “incredibly dangerous operation that essentially cannot be used correctly as the Rust compiler assumes that values are properly initialized”. It will now be deprecated.
The latest release sees the extension of Non-Lexical Lifetimes – a feature to make the borrow checker more user friendly – extended to Rust 2015. It was previously only stable for 2018.
Other changes include: a new” –offline” flag for Cargo; a new Hashmap<k, v> implementation; and a raft of newly stable APIs and library changes.