Mara Bos Profile picture
Rust dev, Electronics engineer, Founder/CTO of Fusion Engineering, @rustlang Library team lead, ADHD, Polyamorous, Lesbian, She/Her
Jacob French 🏴󠁧󠁒󠁷󠁬󠁳󠁿 πŸ¦€ Profile picture 1 subscribed
Dec 15, 2022 β€’ 12 tweets β€’ 4 min read
πŸ†•πŸ¦€ 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 use std::hint::black_box; use std::sync::atomic::{AtomicU64,
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. 🧡

1/10 Today's Rust release contains a long-awaited feature: generic associated types (GATs). πŸŽ‰

This allows associated types to be generic, which unlocks a lot of useful patterns.

See the blog post about the stabilization of this feature for details: blog.rust-lang.org/2022/10/28/gat…

2/10 trait LendingIterator {     type Item<'a> where Self: 'a;
Sep 22, 2022 β€’ 15 tweets β€’ 6 min read
πŸ†•πŸ¦€ A few hours ago, @rustlang 1.64.0 was released! πŸŽ‰

Just like every six weeks, at every new release, here's a thread with some of the highlights. 🧡

1/15

blog.rust-lang.org/2022/09/22/Rus… Rust now has a new async-related trait: IntoFuture.

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 use std::future::{ready, In...
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! ✨

doc.rust-lang.org/stable/std/thr…

2/16 let mut a = vec![1, 2, 3]; let mut x = 0;  std::thread::scop
Jun 30, 2022 β€’ 9 tweets β€’ 4 min read
πŸ†•πŸ¦€ 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 $ cargo add rand     Updating crates.io index       Adding r
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: A table showing before and after times of three tests.  test 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.
Jan 13, 2022 β€’ 11 tweets β€’ 5 min read
πŸ¦€βœ¨ @rustlang 1.58.0 was released just now!

blog.rust-lang.org/2022/01/13/Rus…

As usual, a thread to highlight some of the new features:

1/11 First, a feature we've all been waiting for: Format argument capturing!

let name = "world";
println!("Hello {name}!");

For now, this only works with identifiers, not with more complicated expressions. E.g. `println!("{a.f() + 10}")` does not work.

2/11

Dec 2, 2021 β€’ 11 tweets β€’ 5 min read
πŸ¦€βœ¨ @rustlang 1.57.0 was released just moments ago!

blog.rust-lang.org/2021/12/02/Rus…

As usual, a thread to highlight some of the new features:

1/11 1. panic!() and assert!() can now be used in const fns.

Any formatting other than panic!("..") and panic!("{}", some_str) is not accepted though, because formatting is not const (yet!).

2/11 const fn f<T>() {     assert!(std::mem::size_of::<T>() < 4);error[E0080]: evaluation of constant value failed  --> src/m
Oct 21, 2021 β€’ 17 tweets β€’ 7 min read
A few hours ago, @rustlang 1.56 was released! πŸ¦€

This version ships with the new edition: Rust 2021! 🐊✨🎊

There's quite a few new features in the new version and edition:

1/17 Starting today, `cargo new` will use `edition = "2021"`. You can migrate your 2018 crates with `cargo fix --edition`.

These are all the edition changes:

1. `array.into_iter()` now iterates by value, instead of giving references.

(See for details.)

2/17 for (i, x) in [1, 2, 3].into_iter().enumerate() {        //
Sep 9, 2021 β€’ 11 tweets β€’ 5 min read
πŸ¦€ Happy new Rust! πŸŽ†

Just now, @rustlang 1.55 was released, shipping with some small but very nice improvements.

blog.rust-lang.org/2021/09/09/Rus…

A thread: πŸ¦€ 1. Half-open ranges in patterns.

Next to `start..=end`, you can now also use `start..` as a pattern to match on: fn f(x: u32) {     match x ...
May 6, 2021 β€’ 10 tweets β€’ 5 min read
The new stable version of @rustlang, Rust 1.52, was released just now! πŸ¦€πŸŽ‰

This release contains quite a few new small but significant features.

A thread.

1/10

blog.rust-lang.org/2021/05/06/Rus… My favourite new addition is `str::split_once`.

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   let s = "hello=world";   let (key, val) = s.spliScreenshot of the split_once and rsplit_once documentation.
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 error[E0277]: `[{integer}; 3]` is not an iterator  borrow thfor e in [1, 2, 3] { // Works in 1.53!     println!("{} 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 for e in [1, 2, 3].into_iter() {     // Surprise: `e` is a r
Apr 22, 2021 β€’ 17 tweets β€’ 6 min read
Lots of new standard library additions will become stable in @rustlang 1.53. πŸ¦€πŸŽ‰

Thread: 1. Duration::ZERO, Duration::is_zero(), Duration::MAX pub const ZERO: Duration  A...