ππ¦ 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
Nov 3, 2022 β’ 10 tweets β’ 5 min read
ππ¦ About an hour ago, @rustlang 1.65.0 was released.
As is tradition, here's a thread with some of the highlights. π§΅
The .await syntax be used on anything that implements IntoFuture. (Similar to how, with a for loop, you can iterate over anything that implements IntoIterator.)
This allows types to provide easier async interfaces.
2/15
Aug 11, 2022 β’ 16 tweets β’ 7 min read
ππ¦ Just moments ago, @rustlang 1.63.0 was released! π
It's quite a big release, with even more exciting new features than usual!
Here's a thread with some of the highlights. π§΅
1/16
blog.rust-lang.org/2022/08/11/Rusβ¦
One of the features I'm most excited about is scoped threads! (Although I'm obviously biased, since I worked on this myself.)
As of today, you can use std::thread::scope() to spawn threads that borrow local variables, reducing the need for Arc! β¨
ππ¦ Just moments ago, @rustlang 1.62.0 was released! π
As usual, a thread with some of the highlights. π§΅
1/9
blog.rust-lang.org/2022/06/30/Rusβ¦
Cargo now has 'cargo add' built-in: a (sub)command to add a crate to your Cargo.toml. It automatically looks up the latest version, and shows you the available features of the crate.
See `cargo add --help` for more details.
2/9
May 16, 2022 β’ 4 tweets β’ 1 min read
π¦ As of Rust 1.62 (going into beta this week), std::sync::Mutex, RwLock, and Condvar no longer do any allocations on Linux. π
Benchmarking locks is extremely tricky, as their performance depends heavily on the exact use case, but there are very noticable differences:
std's Mutex basically used to contain a Pin<Box<pthread_mutex_t>>, where the pinned Box was only necessary because pthread_mutex_t is not guaranteed movable. The new Mutex no longer uses pthread, and instead directly uses the futex syscall, making it smaller and more efficient.
We already had str::split and str::splitn, which result in an iterator. But when parsing something simple, you often want to split something exactly once. For example, to parse a string containing `key=value`.
2/10
Apr 24, 2021 β’ 6 tweets β’ 4 min read
I just approved the PR for a very exciting addition to @rustlang 1.53: IntoIterator for arrays ππ¦
Before this change, only references to arrays implemented IntoIterator, which meant you could iterate over &[1,2,3] and &mut [1,2,3], but not over [1,2,3] directly.
1/6
The reason we didn't add it sooner was backwards compatibility. `array.into_iter()` already compiles today, because of the way methods get resolved in Rust. This implicitly calls `(&array).into_iter()`. Adding the trait implementation would change the meaning and break code.
2/6
Apr 22, 2021 β’ 17 tweets β’ 6 min read
Lots of new standard library additions will become stable in @rustlang 1.53. π¦π