Skip to content
← All tracks

Unsafe and Soundness

Rust

Not "the escape hatch" but "the place you owe a proof": UB, raw pointers, invariants, `unsafe` as an audit obligation, and the safe abstractions that discharge it.

This track is written for Rust, which isn't the mode you're browsing in.

0 / 19 solved · 5 articles
  1. 1. Meet Safe and Unsafe: what `unsafe` is actually for Read
  2. 2. Not solved yet. The five superpowers — and the four myths
  3. 3. Not solved yet. `unsafe {}` vs `unsafe fn`: edition 2024 splits the two meanings
  4. 4. Not solved yet. Safety comments as a discipline: `// SAFETY:` and `# Safety`
  5. 5. Not solved yet. Raw pointers: `*const T` and `*mut T`
  6. 6. Not solved yet. `&raw const` / `&raw mut`: a pointer without a reference
  7. 7. Not solved yet. Pointer arithmetic: `offset`, `add`, `sub`, `wrapping_*`
  8. 8. Not solved yet. `ptr::read`, `write`, `copy`, `copy_nonoverlapping`, `drop_in_place`
  9. 9. Not solved yet. `NonNull<T>`, null, and dangling-but-aligned
  10. 10. Not solved yet. Provenance: a pointer is not an integer
  11. 11. What is Undefined Behaviour? The complete list Read
  12. 12. Not solved yet. Validity invariants vs safety invariants
  13. 13. Aliasing: why `&mut` means `noalias` Read
  14. 14. Stacked Borrows, Tree Borrows and Miri Read
  15. 15. Not solved yet. `UnsafeCell`: the only legal path to interior mutability
  16. 16. Not solved yet. Implementing `Vec`: layout, allocation, push, pop
  17. 17. Not solved yet. Implementing `Vec` part 2: `insert`, `remove`, `Deref`, `IntoIter`
  18. 18. Not solved yet. Implementing a reference-counted pointer
  19. 19. Not solved yet. `PhantomData`, variance and drop-check
  20. 20. Safety invariants and privacy: unsafe contaminates the module Read
  21. 21. Not solved yet. Leaking is safe, and exception safety
  22. 22. Not solved yet. Splitting borrows: implement `split_at_mut`
  23. 23. Not solved yet. `union`, `transmute` and `MaybeUninit`
  24. 24. Not solved yet. Partial initialisation and leak-free unwinding: a `MaybeUninit` ring buffer

Check yourself

4 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 4

What does an unsafe block actually turn off?

let x: u32 = 0x4142_4344;
let p = &x as *const u32;
unsafe { *p }
Question 1 of 4