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
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 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.