The Mozilla team announced Rust 2018 Edition Preview 2 today, the final release cycle before Rust 2018 goes into beta. The new release explores features such as the cargo fix command, NLL, along with other changes and improvements.
Rust is a systems programming language by Mozilla. It is a "safe, concurrent, practical language", which supports functional and imperative-procedural paradigms. Rust provides better memory safety while still maintaining the performance.
Let’s have a look at major features in Rust’s 2018 edition preview 2.
The cargo fix command now comes as a built-in feature in Rust. This command is used during migration and addition of this new feature in Rust now further streamlines the migration process. Speaking of migration, extensive efforts have gone into improving and polishing the lints which help you migrate smoothly.
Apart from that, the module system changes are now broken into several smaller features that help with independent tracking issues. There is no need of mod.rs anymore for parent modules Also, the extern crate is not needed anymore for including dependencies. Support has been provided for crate as a visibility modifier.
Another new addition in the Rust 2018 edition preview 2 is that NLLor Non-lexical lifetimes has been enabled by default, in migration mode. NLL improves the Rust compiler's ability to reason about lifetimes. It removes most of the remaining cases where people commonly experience the borrow checker rejecting valid programs.
As per the Rust team, “If your code is accepted by NLL, then we accept it -- if your code is rejected by both NLL and the old borrow checker, then we reject it-- If your code is rejected by NLL but accepted by the old borrow checker, then we emit the new NLL errors as warnings”.
In-band lifetimes have been split up in the latest release. Both rustfmt and the RLS have reached 1.0 “release candidate” status.