Rust programming language 1.64 release

The general-purpose programming language Rust 1.64, 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 requirements for the Linux environment in the compiler, the Cargo package manager, and the libstd standard library have been increased - the minimum requirements for Glibc have been raised from version 2.11 to 2.17, and the Linux kernel from version 2.6.32 to 3.2. The restrictions also apply to Rust binaries built with libstd. The distributions RHEL 7, SLES 12-SP5, Debian 8 and Ubuntu 14.04 meet the new requirements. Support for RHEL 6, SLES 11-SP4, Debian 7 and Ubuntu 12.04 will be discontinued. Users who use Rust-built executables in environments with older Linux kernels are encouraged to upgrade their systems, stay on older compiler releases, or maintain their own libstd fork with layers to maintain compatibility.

    Among the reasons for deprecating support for older Linux systems are limited resources to continue maintaining compatibility with older environments. Support for older Glibcs ​​requires the use of older tooling in continuous integration checks, increased versioning requirements in LLVM, and cross-compilation utilities. The increase in kernel version requirements is due to the ability of libstd to use new system calls without the need to maintain layers to ensure compatibility with older kernels.

  • Stabilized the IntoFuture trait, which resembles the IntoIterator but differs from the latter by using ".await" instead of "for … in …" loops. In combination with IntoFuture, the ".await" keyword can expect not only the Future trait, but also any other types that can be converted to Future.
  • The rust-analyzer utility is included in the collection of utilities shipped with Rust releases. The utility is also available for installation with rustup (rustup component add rust-analyzer).
  • The Cargo package manager implements workspace inheritance to eliminate duplication between packages of typical field values, such as Rust versions and repository URLs. Also, support for building for several target platforms at once has been added (more than one parameter can now be specified in the "--target" option).
  • A new portion of the API has been moved to the category of stable, including the methods and implementations of traits have been stabilized:
    • future::IntoFuture
    • num::NonZero*::checked_mul
    • num::NonZero*::checked_pow
    • num::NonZero*::saturating_mul
    • num::NonZero*::saturating_pow
    • num::NonZeroI*::abs
    • num::NonZeroI*::checked_abs
    • num::NonZeroI*::overflowing_abs
    • num::NonZeroI*::saturating_abs
    • num::NonZeroI*::unsigned_abs
    • num::NonZeroI*::wrapping_abs
    • num::NonZeroU*::checked_add
    • num::NonZeroU*::checked_next_power_of_two
    • num::NonZeroU*::saturating_add
    • os::unix::process::CommandExt::process_group
    • os::windows::fs::FileTypeExt::is_symlink_dir
    • os::windows::fs::FileTypeExt::is_symlink_file
  • C-compatible types, previously stabilized in the std::ffi module, have been added to the main composition (core) and the alloc library:
    • core::ffi::CStr
    • core::ffi::FromBytesWithNulError
    • alloc::ffi::CString
    • alloc::ffi::FromVecWithNulError
    • alloc::ffi::IntoStringError
    • alloc::ffi::NulError
  • The C-types previously stabilized in the std::os::raw module have been added to the core::ffi and std::ffi modules (for example, c_uint and c_ulong types have been proposed for the C-types uint and ulong):
    • ffi::c_char
    • ffi::c_double
    • ffi::c_float
    • ffi::c_int
    • ffi::c_long
    • ffi::c_longlong
    • ffi::c_schar
    • ffi::c_short
    • ffi::c_uchar
    • ffi::c_uint
    • ffi::c_ulong
    • ffi::c_ulonglong
    • ffi::c_ushort
  • Low-level handlers have been stabilized for use with the Poll mechanism (in the future, it is planned to provide a simplified API that does not require the use of low-level Pull and Pin structures):
    • future::poll_fn
    • task::ready!
  • The "const" attribute, which determines the possibility of using it instead of constants in any context, is used in the slice::from_raw_parts function.
  • In order to store data more compactly, the memory layout of the Ipv4Addr, Ipv6Addr, SocketAddrV4 and SocketAddrV6 structures has been changed. May break compatibility with single crate packages that use std::mem::transmute for low-level structure manipulation.
  • The assembly of the rust compiler for the Windows platform uses PGO optimizations (profile-guided optimization), which made it possible to increase the code compilation performance by 10-20%.
  • The compiler has implemented a new warning about unused fields in certain structures.

Additionally, a progress report on the development of an alternative implementation of the Rust compiler prepared by the gccrs project (GCC Rust) and approved for inclusion in GCC can be noted. After integrating the frontend, the standard GCC toolkit can be used to compile Rust programs without the need to install the rustc compiler built using LLVM developments. As long as development is proceeding according to plan, and barring any unforeseen issues, the Rust language front-end will be integrated into the GCC 13 release scheduled for May next year. The Rust implementation in GCC 13 will be in beta status, not yet enabled by default.

Source: opennet.ru

Add a comment