It's very cool that mutexes on Linux don't require an allocation anymore! A very common pattern is to use an Arc<Mutex<T>> for sharing ownership across threads and as far as I can tell this will now only require one allocation instead of two.
`cargo add` is such a small thing, but I'm so excited about it. Many tiny instances of friction as you have to open your browser and manually google a crate to find the latest version number so you can copy and paste it into your Cargo.toml
Dang: "On HN, we handle this [release announcements] by treating submissions of the same-ish story as dupes for a year or so" <a href="https://news.ycombinator.com/item?id=23071428" rel="nofollow">https://news.ycombinator.com/item?id=23071428</a><p>Dang deleting Tauri's 1.0 announcement on the basis of this guideline: <a href="https://news.ycombinator.com/item?id=31764015#31790125" rel="nofollow">https://news.ycombinator.com/item?id=31764015#31790125</a><p>Meanwhile:<p>- this thread<p>- 1.61.0 <a href="https://news.ycombinator.com/item?id=31434936" rel="nofollow">https://news.ycombinator.com/item?id=31434936</a><p>- 1.60.0 <a href="https://news.ycombinator.com/item?id=30944709" rel="nofollow">https://news.ycombinator.com/item?id=30944709</a><p>- 1.59.0 <a href="https://news.ycombinator.com/item?id=30457261" rel="nofollow">https://news.ycombinator.com/item?id=30457261</a><p>- 1.58.0 <a href="https://news.ycombinator.com/item?id=29923390" rel="nofollow">https://news.ycombinator.com/item?id=29923390</a><p>- 1.57.0 <a href="https://news.ycombinator.com/item?id=29416915" rel="nofollow">https://news.ycombinator.com/item?id=29416915</a><p>- 1.56.0 <a href="https://news.ycombinator.com/item?id=28945420" rel="nofollow">https://news.ycombinator.com/item?id=28945420</a><p>- 1.55.0 <a href="https://news.ycombinator.com/item?id=28945420" rel="nofollow">https://news.ycombinator.com/item?id=28945420</a><p>...
Edit: Rust 1.62 uses futexes directly; ParkingLot is a thing but not backing mutex on Linux. Thanks to ibraheemdev for the correction.<p>I'm working to understand how Rust 1.62 avoid allocations for futex-based locks. I think the summary is this:<p>1. A mutex is a u8. The mutex fast path is locking via atomic ops to set a bit.<p>2. Contention is resolved by adding the blocked thread into a wait queue. The queue is allocated/discovered via a global hash table, keyed by the address of the mutex. The mutex keeps a stable address while locked, as the lock holds shared ownership and so the mutex cannot be moved for the duration.<p>I ported a POSIX semaphore wrapper from C++ to Rust, and needed an extra allocation for the same reason, to get an int with a stable address. Unfortunately this technique won't work for semaphores, they need to be async-signal safe. So I'm still stuck with `Pin<Box<UnsafeCell<sem_t>>>` where in C++ it's just `sem_t` and a deleted move constructor.<p>Anyways this is a lot of hoops to jump through to avoid non-movable types, hope it's worth it!
Neat, although the blog post doesn't make this explicit, the new x86_64-unknown-none target disables the red zone, truly making it useful in kernels where otherwise an incoming interrupt would corrupt your stack.
Generic associated types were supposed to be stabilized in 1.62 but there has been a recent backlash in the PR of what exactly to stabilize [0]. I posted it as its own separate post here [1].<p>[0] <a href="https://github.com/rust-lang/rust/pull/96709" rel="nofollow">https://github.com/rust-lang/rust/pull/96709</a><p>[1] <a href="https://news.ycombinator.com/item?id=31939077" rel="nofollow">https://news.ycombinator.com/item?id=31939077</a>