The release of the Rust programming language 1.90, originally developed by Mozilla but now maintained by the independent nonprofit Rust Foundation, has been published. The language focuses on safe memory management and provides tools for achieving high parallelism in task execution, all without the use of a garbage collector and runtime (the runtime is limited to basic initialization and supporting the standard library).
The memory management methods in Rust relieve developers from errors when manipulating pointers and protect against issues arising from low-level memory operations, such as accessing memory after it has been freed, dereferencing null pointers, buffer overflows, and so on. For distributing libraries, ensuring builds, and managing project dependencies, the package manager Cargo is being developed. A repository at crates.io supports library hosting.
Safe memory handling in Rust is ensured at compile time through reference checking, ownership tracking of objects, lifetime consideration (scope) of objects, and assessment of memory access correctness during code execution. Rust also provides means to protect against integer overflows, mandates the initialization of variable values before use, improved error handling in the standard library, employs the concept of immutability for references and variables by default, and offers strong static typing to minimize logical errors.
Key innovations:
- In Linux on x86_64 architecture computers, the LLVM project’s LLD linker is used by default for dynamically linking crate packages. Using LLD compared to the BFD linker has improved the performance of linking large executable files and projects with extensive debugging information, as well as speeding up incremental recompilation. In most cases, LLD is backwards compatible with BFD. If any issues arise, BFD can be reverted by setting the RUSTFLAGS environment variable with the flag ‘-C linker-features=-lld’ or by adding the following to the .cargo/config.toml file: [target.x86_64-unknown-linux-gnu] rustflags = [‘-Clinker-features=-lld’]
- The cargo package manager includes an option ‘—workspace’ in the ‘publish’ command, which allows all crates from the selected workspace (a set of packages using a single Cargo.lock file and a shared build output directory) to be automatically published while preserving the order of package dependencies.
- A new batch of APIs has been promoted to stable, including stabilized methods and trait implementations:
- u{n}::checked_sub_signed
- u{n}::overflowing_sub_signed
- u{n}::saturating_sub_signed
- u{n}::wrapping_sub_signed
- impl Copy for IntErrorKind
- impl Hash for IntErrorKind
- impl PartialEq for CStr
- impl PartialEq for CStr
- impl PartialEq<Cow> for CStr
- impl PartialEq for CString
- impl PartialEq for CString
- impl PartialEq<Cow> for CString
- impl PartialEq for Cow
- impl PartialEq for Cow
- impl PartialEq for Cow
- The ‘const’ attribute has been applied in the functions:
- ::reverse
- f32::floor
- f32::ceil
- f32::trunc
- f32::fract
- f32::round
- f32::round_ties_even
- f64::floor
- f64::ceil
- f64::trunc
- f64::fract
- f64::round
- f64::round_ties_even
- For target platforms based on the Musl library that are at the third level of support, dynamic linking is enabled by default: mips64-unknown-linux-muslabi64, powerpc64-unknown-linux-musl, powerpc-unknown-linux-musl, powerpc-unknown-linux-muslspe, riscv32gc-unknown-linux-musl, s390x-unknown-linux-musl, and thumbv7neon-unknown-linux-musleabihf.
- The target platform "x86_64-apple-darwin" has been upgraded from first-level support to second-level support (Apple plans to discontinue support for the x86_64 architecture). First-level support involves creating binary builds, comprehensive testing, and providing the highest level of support assurance — every change in the compiler is verified by running a full test suite. Second-level support offers a build guarantee but lacks assurances for passing the test suite.
Additionally, Microsoft is developing tools for Windows driver development in Rust. A set of crate packages for creating drivers based on WDM (Windows Driver Kit), KMDF (Kernel-Mode Driver Framework), and UMDF (User-Mode Driver Framework) has already been published on GitHub, along with Win32 services suitable for use in Windows 11. The project's goal is to provide Rust developers with libraries and functions similar to those offered in the WDK toolset for C driver developers. Currently, the Rust driver development toolkit employs a significant number of unsafe calls when interacting with Windows subsystems, but eventually, safe abstractions for kernel structures and DDI (Device Driver Interface) are planned. The project development is released under MIT and Apache 2.0 licenses.
Source: opennet.ru
