🆕🦀 Just an hour ago, #rustlang 1.66.0 was released!
As usual, here's a thread with some of the highlights. 🧵
1/12
Rust 1.66 comes with std::hint::black_box(), a function that does nothing. However, the compiler tries its very best to pretend it doesn't know what it does.
It is useful in benchmarks, to prevent the compiler from optimizing your entire benchmark away.
2/12
The Option type got a new method: Option::unzip(). It's basically the opposite of Option::zip(): it splits an Option of a pair into a pair of Options.
3/12
There are now methods on the integer types for mixing signed and unsigned integers in addition and subtraction.
For example, i64::checked_add_unsigned() adds a u64 to a i64, but will return None when the value would overflow.
4/12
BTreeSet and BTreeMap now have functions for working with the first and last element. These structures keep their elements sorted, so these methods allow easy access to the largest and smallest ones.
5/12
The file descriptor types and traits are now available from std::os::fd, instead of only from std::os::unix::io and std::os::wasi::io. This makes it a bit easier to make software that runs on both Unix and Wasi.
6/12
As of today's Rust release, inline assembly supports `sym` operands to refer to symbols from within the assembly code.
7/12
Patterns now support half open ..=X ranges:
8/12
Procedural macros can now access the original source text through Span::source_text(), which is useful for diagostics (and horrible macro crimes).
9/12
Tuple and struct enum variants can now also be assigned a discriminant, just like unit variants, when using the #[repr] attribute on the enum to give it a predictable layout.
10/12
With the release of version 1.66, Cargo now has a built-in "cargo remove" command, to complement the "cargo add" command.
11/12
And that's the end of today's Rust release thread. 🏁
For a more complete list of changes in Rust 1.66, check out the release notes:
Rust: github.com/rust-lang/rust…
Cargo: github.com/rust-lang/carg…
Clippy: github.com/rust-lang/rust…
Enjoy! ✨🦀
12/12
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.