
Workshop: 3 days
Migrating C to Rust
Workshop description
Migrating C code to Rust is rarely a single “rewrite” step. It’s a process that forces you to weave together these two very different systems. Calling conventions, memory management, tooling, and (most importantly) how you structure and test your code. These things can quickly explode in complexity if misunderstood or incorrectly managed.
We designed this workshop to give your team a coherent path from “I can write Rust” to “I can ship Rust in a C codebase” without hand-waving over these complexities.
We start from the fundamentals of C/Rust interoperability and gradually build up to a pragmatic module rewrite process, touching on performance, testing, debugging, and long-term maintainability.
By the end of the workshop, you will have a clear mental model of Rust’s FFI boundaries, know how to design FFI-friendly APIs, have written plenty of (correct) unsafe code, and have a concrete playbook to migrate real modules with confidence.
The workshop is designed for software developers working in or around C/C++ codebases. Familiarity with Rust basics is helpful, but we’ll introduce the concepts you need as we go.
We will cover the essentials of FFI-safe Rust: extern "C", ABI considerations, #[no_mangle], and when to use repr(C).
We will look at how Rust links C code in practice: the -sys crate pattern, using build.rs, integrating with existing build systems, and generating bindings with bindgen — followed by how to build safe abstractions on top of unsafe bindings.
We will translate common C idioms into idiomatic Rust: iterators instead of manual loops, return values vs out-parameters, vtables vs traits (and when to keep the C shape), strings and encodings (CStr vs str), return codes vs errors, as well as bitflags.
Testing, benchmarks, sanitizers, and more. We will put our FFI code on solid foundations. We will learn how to effectively use tools like Valgrind, sanitizers, and Miri. We will discover their limitations and when to reach for which tool.
