Rust 1.30 to be Released

Check the new features of this Mozilla supported programming language
29 October 2018   488

The release of the system programming language Rust 1.30, developed by the Mozilla project. The language is focused on safe work with memory, provides automatic memory management and provides the means to achieve high parallelism in the execution of tasks, while doing without the use of garbage collection and runtime.

178 developers took part in the preparation of the new release. 

The creators of the language drew attention to the fact that the rules for working with modules in Rust are unintuitive and make it difficult to master the language. In version 1.30, they tried to make this system more understandable by making some changes to use.

External containers are now loaded first:

// old
let json = ::serde_json::from_str("...");
// new
let json = serde_json::from_str("...");

Thanks to this fix, when processing code, external containers will be used regardless of the module hierarchy.

In addition, use expresses objects with the help of the crate keyword:

mod foo {
    pub fn bar() {
        // ...
    }
}

// old
use ::foo::bar;
// or
use foo::bar;

// new
use crate::foo::bar;

In Rust 1.30, developers have implemented the option of creating two new types of procedural macros. Attribute-like macro allows the user to define their own attributes. It also has more flexibility in operation than user extraction, since it can be used in functions. As an example, the developers cite the code that will be used in the framework of the web application:

#[route(GET, "/")]
fn index() {

At the same time, the #[route] attribute is determined by the framework itself and may look like this:

#[proc_macro_attribute]
pub fn route(attr: TokenStream, item: TokenStream) -> TokenStream {

In this case, the macro code sql! in the program code! used as follows:

let sql = sql!(SELECT * FROM posts WHERE id=1);

The developers have added the ability to display macros in the field of view using the use. This measure helped streamline the code and eliminate the macro_use annotation.

The proc_macro container is now stable, which allows using the API for writing macros.

Since as the language developed, the set of keywords gradually changed, in Rust 1.30 it was decided to make available the use of such words as identifiers using the #r prefix.

// define a local variable named `for`
let r # for = true;

// define a function named `for`
fn r # for () {
    // ...
}

// call that function
r # for ()

The creators of Rust thought about users who work with RTL writing, so in the names of some functions the word “left” was replaced with “start”, and “right” with “end”.

Mozilla to Release New Version of Rust

There're a lot of updates and new features in new version of programming language
15 April 2019   232

Mozilla released new version of Rust programming language, 1.34. The language focuses on safe memory management, provides automatic memory management and provides the means to achieve high parallelism in the execution of tasks, while avoiding the use of garbage collection and runtime.

Automatic memory management in Rust saves the developer from manipulating pointers and protects against problems arising from low-level work with memory, such as accessing the memory area after it is released, dereferencing null pointers, going out of the buffer boundaries, etc. To distribute the libraries, provide the build and manage the dependencies of the project, the Cargo package manager is developed, which allows you to get the necessary libraries for the program in one click. The library contains the crates.io repository.

These are main updates:

  • Added tools to work with alternative package registries that can coexist with the crates.io public registry in the Cargo package manager.
  • The section [registries] is provided for adding external registries to .cargo/config (located in $HOME or in the package directory), and the option "registry" appeared in Cargo.toml to use an external registry in the description of each dependency.
  • Added full support for using the ? Operator in doctests tests that allow the use of sample code from the documentation as tests. 

Get more info at official website.