
Undefined Behaviour in Unsafe Rust and How Miri Detects It
Safe Rust has no undefined behavior, but unsafe blocks can. See what counts as UB in unsafe Rust and how the Miri interpreter reports each kind.
Tag
36 posts

Safe Rust has no undefined behavior, but unsafe blocks can. See what counts as UB in unsafe Rust and how the Miri interpreter reports each kind.

Bridge sync and async Rust with a Tokio Runtime and Handle::block_on, and avoid the nested-runtime panic from calling block_on inside a task.

Write Linux systems code in Rust with compile-time ownership checks, safe syscall wrappers, and the exact boundary where unsafe remains necessary.

Learn embedded Rust from an empty directory to flashed, logged, interrupt-driven firmware on a Cortex-M board, with the toolchain, crates and mental model.

Pick the right Tokio channel: mpsc for queues, oneshot for one reply, broadcast for fan-out and watch for the latest value, each with a working example.

Write Linux 6.18 drivers in Rust: toolchain, module anatomy, pinned initialization, device lifetimes, misc, platform, PCI and PHY drivers, testing and style.

Cancel async work in Tokio by dropping futures, racing them with select!, and signalling many tasks at once with tokio-util's CancellationToken.

Move blocking calls and heavy computation off Tokio's worker threads with spawn_blocking so one slow task cannot stall every other task on the runtime.

Build a TCP echo server with Tokio's TcpListener, spawn one task per connection and copy bytes back, then test it with a client over loopback.

Asynchronous I/O lets one thread wait on many sockets at once; an async runtime polls futures and sleeps in epoll until the kernel reports readiness.

Learn threads from first principles in C with pthreads, C++ with std::thread and jthread, and Rust: create, join, share data, stop, name and debug them.

How async runtimes work from the kernel up: readiness and completion I/O, epoll, io_uring, reactors, executors, Tokio internals and how to choose.