The multi-paradigm compiled programming language Rust is gradually receiving support for use as a system language. In 2021, Linus Torvalds and Greg Kroah-Hartman shared their views on how they see work with Rust programming language in a Linux kernel written in C programming language.
The developers of a kernel Linux seriously thought of the use of Rust for the new embedded code. In March 2021, the Linux-next branch, based on which the release of the Linux 5.13 kernel was formed, came to encompass an initial set of components for developing device drivers on Rust. Documentation on the use of Rust in a Linux kernel and an example of the module of a kernel with the driver of the symbolical device on Rust were separately published. A branch maintainer Stephen Rothwell added this new code.
A year ago, Amazon Web Services (AWS) released Bottlerocket Linux with Rust. AWS products manager Samarth Chandrashekhar noted it helps to ensure the safety of streams and to prevent the mistakes connected with an overflow of the buffer memory that can cause safety vulnerabilities.
Meanwhile, Sylvester Ledru, Mozilla director and Debian Linux developer, ported the Coreutils version to Rust to Linux using LLVM. Coreutils are the main GNU shell utilities. Using them, Ledru downloaded Linux and launched the most popular Debian packages.
According to the Linux developer Nelson Elhage, supporters of this language didn’t suggest rewriting a kernel of Linux on Rust; they focused on the movement of writing the new code.
However, in the further discussion of supporting the embedding of the Rust language, the following concerns arose: how the use of existing APIs in the kernel, architecture support, and compatibility of the binary application interface (ABI) between the Rust and C languages can be implemented.
Then Torvalds noted: “The first goal for Rust is drivers because there are different implementation ways.” According to him, many drivers are relevant only for a pair of target architectures, so the problem with the Rust code, not supported by some architectures, is not such a principal.
Kroah-Hartman agreed drivers are probably the first place for similar attempts as they depend on the functionality of a kernel, but nothing depends on them.
Torvalds emphasized that some dislike the idea of using Rust in the user space. Kroah-Hartman added everything comes down to how well the display level of interaction between structures of a kernel of Linux and the time rules written on C and lifetime rules for drivers in structures of Rust.
In 2020 Torvalds already assumed that for the things which aren’t central for the kernel, for example, for drivers, interfaces can appear including on Rust. Later, Kroah-Hartman confirmed that in using the permission of Rust for code writing of a kernel, they observed progress.
Last year, AWS, Huawei, Google, Microsoft, and Mozilla created the Rust Foundation, a non-profit organization that develops this programming language. The budget for two years of operation will be $1 million.
Thus, on February 24, 2022, the developers announced the release of a new version of the Rust 1.59.0 programming language.
If you have a previous version of Rust installed through rustup, then to upgrade to version 1.59.0, just run the command: “rustup update stable”.
If you don’t already have a rustup, you can install it from a page on the project website. It also published a detailed description of the new version on GitHub.
The major innovations in Rust 1.59.0:
- support for assembly inserts and assembly instructions for x86, x86-64, ARM, AArch64, and RISC-V architectures;
- support of destructed (parallel) assignments;
- the possibility of values sign by default for constant generics («const generics»);
- Cargo Batch Manager adds usage warnings to dependencies of invalid constructs handled due to compiler errors;
- the possibility of generation of the executable files cleaned from debugging data (strip = “debuginfo”) and symbols (strip = “symbols”), with no need for a call of the separate utility in cargo and rustc;
- incremental compilation by default as a temporary measure because of the mistake in the compiler leading to failures and a conclusion of errors of deserialization to turn off. For the return of incremental compilation, it is possible to use RUSTC_FORCE_INCREMENTAL=1 environmental variable;
- a large list of APIs has been transferred to the category of stable ones, as well as methods and implementations of types.
Also, in the new version of Rust, there are changes and completions in the compiler and frameworks. The collection of the prominent sources for studying Rust language is collected here.
The previous version of Rust 1.58.0 was released on January 13, 2022. There were also many changes, including the ability to substitute arbitrary identifiers through the additional expressions to the string, as well as refinement of the mechanisms and format of the compiler.