Chapter 5. Changes in Rust 1.62.1 Toolset
Rust Toolset has been updated from version 1.58.0 to 1.62.1 on RHEL 7, RHEL 8, and RHEL 9.
Notable changes include:
-
Destructuring assignment allows patterns to assign to existing variables in the left-hand side of an assignment. For example, a tuple assignment can swap to variables:
(a, b) = (b, a); -
Inline assembly is now supported on 64-bit x86 and 64-bit ARM using the
core::arch::asm!macro. See more details in the "Inline assembly" chapter of the reference, "/usr/share/doc/rust/html/reference/inline-assembly.html". (online at https://doc.rust-lang.org/reference/inline-assembly.html) -
Enums can now derive the
Defaulttrait with an explicitly annotated#[default]variant. -
Mutex,CondVar, andRwLocknow use a customfutex-based implementation rather than pthreads, with new optimizations made possible by Rust language guarantees. -
Rust now supports custom exit codes from
main, including user-defined types that implement the newly-stabilizedTerminationtrait. - Cargo supports more control over dependency features. The "dep:" prefix can refer to an optional dependency without exposing that as a feature, and a "?" only enables a dependency feature if that dependency is enabled elsewhere, like "package-name?/feature-name".
-
Cargo has a new
cargo addsubcommand for adding dependencies toCargo.toml.