The latest version of the Rust programming language, Rust 1.66, is now available. 

In Rust 1.66, enums that have fields can now use explicit discriminants. This can be used to pass values across language boundaries that require the enum representation to match in both languages. 

Previously explicit discriminants could only be used if none of the enum variants contained fields. 

RELATED CONTENT: Rust’s addition to the Linux kernel seen as “enormous vote of confidence” in the language

This release also includes the new “black_box” function, which takes the value passed to it and passes it right back. Internally in the compiler, however, it is treated as a function that could do anything with the input and then return anything. “Black_box” is useful for disabling optimizations, which there is an example of in the release notes.  

A new command line utility “cargo remove” has been added in this release. It enables you to remove dependencies. A few releases back in Rust 1.62, “cargo add” was introduced for adding them in. 

In addition to these new features, the Rust team revealed that Linux builds will now optimize the rustc frontend and LLVM backend using LTO for frontend and BOLT for the backend. This will improve both runtime performance and memory usage. 

Other changes include the ability to use “..=X” ranges in patterns, and a number of APIs becoming stabilized. 

To learn more about the changes and for code examples of new things you can do in Rust, view the blog post about this release.