The Unsafe Chronicles: Exhibit A: Aliasing Boxes
In this new series we take deep-dives into the world of unsafe Rust. These chronicles aren't necessarily aimed at teaching you how to write unsafe code, but instead try to showcase particular things to keep in mind when it comes to safety in Rust. In particular, in each episode we'll look at a specific (and usually tricky) source of unsoundness, and how to work around it. This particular episode focuses on the journey to aliasing boxed values in the left-right crate (https://docs.rs/left-right/), which we developed in a previous stream, and was augmented in https://github.com/jonhoo/rust-evmap/.... left-right wishes to alias types between two different copies of a data structure, but doing so leads down an interesting rabbit hole around the safety of aliasing and casting. 0:00:00 About this new series 0:01:48 left-right and evmap 0:06:31 Expressing the problem in code 0:15:28 Why is aliasing a Box not okay? 0:19:09 Aliasing Box with MaybeUninit 0:39:48 Dropping aliases 0:55:15 The cast is unsound 1:00:45 Making the cast sound 1:10:47 Q&A 1:26:43 Unsoundness from non-determinism 1:28:25 More Q&A 1:35:14 Outroduction Some relevant issues: evmap unsoundness issue: https://github.com/jonhoo/rust-evmap/... Aliasing rules for Box{T}: https://github.com/rust-lang/unsafe-c... Deterministic layout: https://github.com/rust-lang/unsafe-c... Deterministic Eq+Hash: https://github.com/jonhoo/rust-evmap/... You can watch the live version with comments at • The Unsafe Chronicles: Exhibit A: Aliasing...

The Mystery of the Pin - Martin Hoffmann - RustNL 2023

Unsafe Rust is not C

The Cost of Concurrency Coordination with Jon Gjengset

Crust of Rust: Send, Sync, and their implementors

Rust Functions Are Weird (But Be Glad)

Crust of Rust: Dispatch and Fat Pointers

The Dark Side of .reserve()

Boxes, Heaps, and Stacks - Tim McNamara - Rust Linz, September 2022

Crust of Rust: Iterators

Rust Interior Mutability - Sneaking By The Borrow Checker

Decrusting the serde crate

"We Ran Out Of Columns" - The Worst Codebase Ever

Think Twice Before Using Async Rust | Prime Reacts

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

Considering Rust

P99 CONF - Zig vs Rust

Something is jamming GPS over Europe. Here's what we found

Q&A December 2023

Rust's Witchcraft

