Programming language Rust 1.46 released

Programming language Rust 1.46 released
3 min read
27 August 2020

Release 1.46 of the system programming language Rust, founded by the Mozilla project, has been published. The language focuses on safe memory management, provides automatic memory management, and provides the means to achieve high parallelism of job execution, while avoiding the use of a garbage collector and runtime.

Automatic memory management in Rust relieves the developer from errors when manipulating pointers and protects against problems arising from low-level memory manipulation, such as accessing a memory area after it is freed, dereferencing null pointers, exceeding buffer boundaries, etc. To distribute libraries, provide assembly and manage project dependencies, the Cargo package manager is being developed, which allows you to get the libraries you need for a program in one click. The crates.io repository is supported for placing libraries.

Major innovations :

  • The capabilities of functions defined using the "const fn" expression have been expanded, which can be called not only as ordinary functions, but also be used in any context instead of constants. These functions are evaluated at compile time, not at runtime, so certain restrictions are imposed on them, such as the ability to read only constants.

    In the new release, the ban on the use of boolean operators ("&&" and "||") in such functions has been removed, the use of the constructs "if", "if let", "match", "while", "while let" and "loop" is allowed, and also provides 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 take some resource-intensive operations to the compilation stage. For example, the implementation of "const-sha1" allows compilation of SHA-1 hashes at compile time, which results in an up to 40x faster WinRT bindings for Rust.

  • To improve the informativeness of error messages, support for the "# [track_caller]" attribute has been stabilized, which is useful for functions like unwrap, which do not exclude panic if types are used incorrectly. The specified attribute will be used by the panic handler to display the location of the caller in an error message.
  • The "const" feature, 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 Option::zip and vec::Drain::as_slice stabilized.
  • The Cargo package manager has added support for new environment variables that are set during package compilation: CARGO_BIN_NAME (the name of the resulting executable file), CARGO_CRATE_NAME (package name), CARGO_PKG_LICENSE (the license specified in the manifest), CARGO_PKG_LICENSE_FILE (path to the file with the license).
In case you have found a mistake in the text, please send a message to the author by selecting the mistake and pressing Ctrl-Enter.
Alex 9.8K
Joined: 4 years ago
Comments (0)

    No comments yet

You must be logged in to comment.

Sign In / Sign Up