Get the latest tech news

Rust panics under the hood, and implementing them in .NET


I am currently working on a Rust to .NET compiler, rustc_codegen_clr. To get it to work, I need to implement many Rust features using .NET APIs.

Instead of using LLVM to generate native code, my project turns the internal Rust representation called MIR, into .NET Common Intermediate Language. It makes analyzing control flow almost trivial - since we know that only terminators can change how the code is executed, we don't have to check each statement to figure out the relationships between blocks. The real MIR looks a bit different(no variable names, explicit types of locals, calls that return nothing assign a() value), but this should give you a rough idea about how everything works.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of hood

hood

Photo of Rust panics

Rust panics

Related news:

News photo

Ban warnings fly as users dare to probe the “thoughts” of OpenAI’s latest model | OpenAI does not want anyone to know what o1 is “thinking" under the hood

News photo

Pixel 9 Pro XL teardown shows some promising changes under the hood

News photo

Turns out the new Google TV Streamer has a different chip under the hood