Rust 1.36.0 Releases with Stabilized Futures

July 5, 2019 Posted by News 0 thoughts on “Rust 1.36.0 Releases with Stabilized Futures”

The slow progression of Rust continues with the latest 1.36.0 release. When it comes to languages, minor version updates aren’t usually newsworthy. And major version updates, though they bring interesting features, are worth having someone else trip over their faults before making the jump yourself. What makes this latest Rust version stand alone is that rather than introducing a slew of new tools, this Rust version has stabilized the future.

There’s a new Future

The Future trait is something that Rust developers have been long waiting for. Just like JavaScript promises, Futures abstract concurrency. Being able to chain futures and handle responses as if you were writing synchronous code is invaluable. Unlike promises, futures act like a pointer to a value that does not exist at the moment, allowing you more flexibility when using async(and more room for scope errors, thus the must_use validator). The only thing holding back this news is the fact that async/await hasn’t been fully implemented in Rust. The Rust team announced that following the stabilization of futures, they “hope to give important crates, libraries, and the ecosystem time to prepare for async / .await…”

Stabilizing the alloc crate

Before this update, the previous alloc crate made it difficult for library maintainers who sparsely use std to also provide support #![no_std] since std required a global allocator and other OS capabilities. Now, those parts of std that relied on a global allocator will be availabe in the alloc crate and will be re-exported by std.

Mem:uninitialized is replaced with MaybeUninit<T>

This new release also prevents clever developers from performing the dangerous mem::uninitialized hack to lazily allocate arrays. The problem with this hack is the fact that one bypasses Rust’s initialization check, which means that no matter what value goes through, Rust assumes that they are valid, which is a hacker’s dream. To placate the need to lazily allocate arrays, the Rust team stabilized MaybeUninit<T>; now, Rust compilers and devs are on the same page.

There’s more

There’s much more to dig through in this release like smarter borrow checkers thanks to NLL, a new, faster HashMap based on the SwissTable design, and offline support in Cargo. Rust’s GitHub page allows you to dive deep into many of the changes that have been made; for example, non-macro attributes allow for all literals, not just strings.

Please follow and like us: