Rust programming language 1.67 release

The general-purpose programming language Rust 1.67, founded by the Mozilla project but now developed under the auspices of the independent non-profit organization Rust Foundation, has been released. The language focuses on memory safety and provides the means to achieve high job parallelism while avoiding the use of a garbage collector and runtime (runtime is reduced to basic initialization and maintenance of the standard library).

Rust's memory handling methods save the developer from errors when manipulating pointers and protect against problems that arise due to low-level memory handling, such as accessing a memory area after it has been freed, dereferencing null pointers, buffer overruns, etc. To distribute libraries, provide builds and manage dependencies, the project develops the Cargo package manager. The crates.io repository is supported for hosting libraries.

Memory safety is provided in Rust at compile time through reference checking, keeping track of object ownership, keeping track of object lifetimes (scopes), and assessing the correctness of memory access during code execution. Rust also provides protection against integer overflows, requires mandatory initialization of variable values ​​before use, handles errors better in the standard library, applies the concept of immutable references and variables by default, offers strong static typing to minimize logical errors.

Main innovations:

  • Async functions with Future::Output can now be specified with "#[must_use]" annotations that include a warning if a return value is ignored, which helps to detect errors caused by the assumption that the function will change values ​​rather than return a new value. #[must_use] async fn bar() -> u32 { 0 } async fn caller() { bar().await; } warning: unused output of future returned by `bar` that must be used --> src/lib.rs:5:5 | 5 | bar().await; | ^^^^^^^^^^^ | = note: `#[warn(unused_must_use)]` on by default
  • The implementation of std::sync::mpsc (multi-producer single-consumer) FIFO queues has been updated to use the crossbeam-channel module while maintaining the same API. The new implementation is distinguished by the solution of a number of problems, higher performance and simplification of code maintenance.
  • A new portion of the API has been moved to the category of stable, including the methods and implementations of traits have been stabilized:
    • {integer}::checked_ilog
    • {integer}::checked_ilog2
    • {integer}::checked_ilog10
    • {integer}::log
    • {integer}::ilog2
    • {integer}::ilog10
    • NonZeroU*::ilog2
    • NonZeroU*::ilog10
    • NonZero*::BITS
  • The "const" attribute, which determines the possibility of using it in any context instead of constants, is used in functions:
    • char::from_u32
    • char::from_digit
    • char::to_digit
    • core::char::from_u32
    • core::char::from_digit
  • Implemented third level support for using Rust in the Linux kernel (linuxkernel), as well as for Sony PlayStation 1 (mipsel-sony-psx), PowerPC with AIX (powerpc64-ibm-aix), QNX Neutrino RTOS (aarch64-unknown-nto- qnx710, x86_64-pc-nto-qnx710). The third level implies basic support, but without automated testing, publishing official builds and checking the ability to build the code.

Additionally, we can note the publication by ARM of patches that allow using the Rust language to develop drivers and Linux kernel modules compiled for systems based on the AArch64 architecture.

Source: opennet.ru

Add a comment