Rust programming language 1.46 release

Published release 1.46 of the systems programming language Rustfounded by the Mozilla project. The language focuses on safe memory management, provides automatic memory management, and provides the means to achieve high job parallelism while avoiding the use of a garbage collector and runtime.

Rust's automatic memory management saves the developer from errors when manipulating pointers and protects against problems that arise due to low-level memory manipulation, such as accessing a memory area after it has been freed, dereferencing null pointers, buffer overruns, etc. To distribute libraries, ensure assembly and manage dependencies, the project develops a package manager Job, which allows you to get the libraries you need for the program in one click. A repository is supported to host libraries crates.io.

All innovations:

  • The possibilities of functions defined using the "const fn" expression have been extended, which can be called not only as ordinary functions, but also used in any context instead of constants. These functions are evaluated at compile time, not at run time, so they are subject to certain restrictions, such as being able to read only from constants.

    In the new release, the prohibition on the use of Boolean operators ("&&" and "||") in such functions has been removed, the use of the "if", "if let", "match",
    "while", "while let" and "loop", as well as the ability to convert to slices (slice, dynamic arrays) using the expression "&[T]". The use of these features in the "const fn" functions allows you to move some resource-intensive operations to the compilation stage. For example, the implementation of "const-sha1" makes it possible to calculate SHA-1 hashes at compile time, which leads to the acceleration of WinRT bindings for Rust by almost 40 times.

  • Support for the "#[track_caller]" attribute has been stabilized to make error messages more informative, which is useful for functions like unwrap that can't avoid panics when types are used incorrectly. The specified attribute will be used by the panic handler to print the location of the caller in the error message.
  • The "const" attribute, which determines the possibility of using it in any context instead of constants, is used in the std::mem::forget method.
  • A new portion of the API has been moved to the stable category, including the stabilization of Option::zip and vec::Drain::as_slice.
  • To the Cargo package manager added support for new environment variables set during package compilation: CARGO_BIN_NAME (name of the resulting executable file), CARGO_CRATE_NAME (package name), CARGO_PKG_LICENSE (license specified in the manifest), CARGO_PKG_LICENSE_FILE (path to the license file).

Source: opennet.ru

Add a comment