Rust 1.36

The development team is excited to introduce Rust 1.36!

What's new in Rust 1.36?
The Future trait has been stabilized, among the new features: the alloc crate, MaybeUninit, NLL for Rust 2015, a new implementation of HashMap, and a new flag —offline for Cargo.


And now, more details:

  • In Rust 1.36, the Future trait has finally been stabilized.
  • The alloc crate.
    Starting with Rust 1.36, parts of std that depend on the global allocator (such as Vec) are now in the alloc crate. std now re-exports these parts. More on this.
  • MaybeUninit replaces mem::uninitialized.
    In previous releases, mem::uninitialized allowed you to bypass initialization checks, which was used for lazy allocation of arrays, but this feature is quite dangerous (more details), which is why the MaybeUninit type has been stabilized, which is safer.
    Since MaybeUninit is a safer alternative, starting with Rust 1.38, mem::uninitialized will be deprecated.
    If you want to learn more about uninitialized memory, you can read the blog post (Alexis Beingessner).
  • NLL for Rust 2015.
    In the announcement of Rust 1.31.0 the developers told us about NLL (Non-Lexical Lifetime), an improvement for the language that makes the borrow checker smarter and more user-friendly. Example:
    fn main() {
    let mut x = 5;
    let y = &x;
    let z = &mut x; // This was not allowed before 1.31.0.
    }

    In 1.31.0, NLL only worked in Rust 2018, with a promise that support would be added for Rust 2015 as well.
    If you want to learn more about NLL, you can read more in this the blog post (Felix Klocks).

  • A new flag for Cargo — —offline.
    In Rust 1.36, a new flag for Cargo was stabilized. The —offline flag tells Cargo to use locally cached dependencies, so they can be used later without an internet connection. When required dependencies are not available offline, and if the internet is needed, Cargo will return an error. To download dependencies in advance, you can use the cargo fetch command, which will download all dependencies.
  • Here You can read a more detailed overview of the changes.

There are also changes in the standard library:

Other changes Rust, Cargo and Clippy.

Source: linux.org.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster