Rust programming language 1.62 release

The general-purpose programming language Rust 1.62, 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:

  • The "cargo" package manager offers the "add" command, which allows you to add new dependencies to the Cargo.toml manifest or change existing dependencies from the command line. The command also allows you to specify individual features (feature) and versions, for example: cargo add serde --features derive cargo add nom@5
  • Added the ability to use "#[derive(Default)]" with enums in which a default variant is defined using the "#[default]" attribute. #[derive(Default)] enum Maybe { #[default] Nothing, Something(T), }
  • On the Linux platform, a more compact and faster implementation of the Mutex synchronization mechanism is used, based on the use of futexes provided by the Linux kernel. Unlike the previously used implementation based on the pthreads library, the new version uses only 5 bytes instead of 40 to store the Mutex state. Similarly, the Condvar and RwLock locking mechanisms have been transferred to futex.
  • Implemented the second level of support for the x86_64-unknown-none target platform, designed to generate executable files that can work without an operating system. For example, the specified target platform can be used when writing kernel components. The second level of support implies a build guarantee.
  • Implemented third level support for aarch64-pc-windows-gnullvm and x86_64-pc-windows-gnullvm platforms. The third level implies basic support, but without automated testing, publishing official builds and checking the ability to build the code.
  • A new portion of the API has been moved to the category of stable, including the methods and implementations of traits have been stabilized:
    • bool::then_some
    • f32::total_cmp
    • f64::total_cmp
    • stdin::lines
    • windows::CommandExt::raw_arg
    • impl default value for AssertUnwindSafe
    • From > for Rc
    • From > for Arc<[u8]>
    • FusedIterator for EncodeWide

    Source: opennet.ru

Add a comment