Chapter 5. Changes in Rust 1.66.1 Toolset
Rust Toolset has been updated from version 1.62.1 to 1.66.1 on RHEL 7, RHEL 8, and RHEL 9.
Notable changes include:
-
The
thread::scopeAPI creates a lexical scope in which local variables can be safely borrowed by newly spawned threads, and those threads are all guaranteed to exit before the scope ends. -
The
hint::black_boxAPI adds a barrier to compiler optimization, which is useful for preserving behavior in benchmarks that might otherwise be optimized away. -
The
.awaitkeyword now makes conversions with theIntoFuturetrait, similar to the relationship betweenforandIntoIterator. - Generic associated types (GATs) allow traits to include type aliases with generic parameters, enabling new abstractions over both types and lifetimes.
-
A new
let-elsestatement allows binding local variables with conditional pattern matching, executing a divergentelseblock when the pattern does not match. -
Labeled blocks allow
breakstatements to jump to the end of the block, optionally including an expression value. -
rust-analyzeris a new implementation of the Language Server Protocol, enabling Rust support in many editors. This replaces the formerrlspackage, but you might need to adjust your editor configuration to migrate torust-analyzer. -
Cargo has a new
cargo removesubcommand for removing dependencies fromCargo.toml.