Rust 2018 RC1 was released yesterday. This new version of the Rust programming language contains features like raw identifiers, better path clarity and other additions. Some of the changes in Rust 2018 RC1 include:
Like many programming languages, Rust too has the concept of "keywords". These identifiers cannot be used in places like variable names, function names, and other places. With Rust 2018 RC1, raw identifiers let you use keywords where they are not allowed normally. New confirmed keywords in Rust 2018 RC1 are async, await, and try.
One of the hardest things for people new to Rust is the module system. While there are simple and consistent rules defining the module system, their consequences can appear to be inconsistent and hard to understand.
Rust 2018 RC1 introduces a few new module system features to simplify the module system and give a better picture of what is going on.
Parameters in trait method declarations are no longer allowed to be anonymous.
In Rust 2015, the following was allowed:
trait Foo {
fn foo(&self, u8);
}
In Rust 2018 RC1, all parameters require an argument name (even if it's just _):
trait Foo {
fn foo(&self, baz: u8);
}
The borrow checker has been enhanced to accept more code. This is performed via a mechanism called ‘non-lexical lifetimes’. Previously, the below code would have produced an error, but now it will compile just fine:
fn main() {
let mut x = 5;
let y = &x;
let z = &mut x;
}
Lifetimes follow "lexical scope". This means that the borrow from y is considered to be held until y goes out of scope at the end of main. This is the case even though y will never be used again in the code. The above code works fine, but in the older versions, the borrow checker was not able handle it.
To try and install Rust 2018 RC1 you need to install the Rust 1.30 beta toolchain. This beta is a little different from the normal beta, states the Rust Blog.
> rustup install beta > rustc +beta --version rustc 1.30.0-beta.2 (7a0062e46 2018-09-19)
The feature flags for Rust 2018 RC1 are turned on and can be used to report issues.
These were only a select few changes. Other changes in this beta include Lifetime elison in impl, T: ‘a inference in structs, macro changes etc. For more information and details on the complete list of updates, read the Rust edition guide where the new features are marked as beta.
Rust 1.29 is out with improvements to its package manager, Cargo
Deno, an attempt to fix Node.js flaws, is rewritten in Rust
Creating Macros in Rust [Tutorial]