~/talk

Corrosive C - Compiling Rust to C to target new platforms

Talkat RustWeek 2025 · 2025-05-13..05-17· [rust, embedded-and-hardware]
slides:none on file

Project compiles Rust MIR into C by replacing rustc’s backend and targets platforms that only have a C compiler, producing C that keeps local numbering and compiles Rust MIR to C back end. Generated C preserves debug info with line directives and uses workarounds for undefined behavior: replace signed ops with unsigned, add checks for shifts and float casts, and use memcpy for loads/stores to avoid strict aliasing. Tooling includes running rustc’s test suite (about 96% of core compiler tests pass), ~400–500 custom tests, and ~40k LOC of code while keeping symbol names via hashing.

AI-written summary · about

  1. 0:00Introduction
  2. 3:12Compile Rust to C for platforms
  3. 8:52Rust compiler architecture
  4. 12:42Undefined behavior in C
  5. 25:45Translation challenges and solutions
  6. 30:00Testing generated C
  7. 33:53Project scope and future
  8. 37:27Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.