The Rust to .NET compiler backend now supports stack unwinding, and runs on ARM!

162 points FractalFir

My Rust to .NET compiler backend now supports stack unwinding.

The current solution still leaves a lot to be desired in terms of performance and test coverage, but it marks an important milestone for the project. Stack unwinding enables proper handling of panics, which should enable me to run more complex tests in the future.

Adding unwinding required a rewrite of major parts of the project (switched to a different internal IR), which should make future development and optimizations easier.

The project has also been tested on 64-bit ARM! I managed to get the .NET runtime and the project working on my Android phone, and all the tests pass. Additionally, identical assemblies work on ARM and x86\_64, enabling you to compile Rust code into cross-platform assemblies.

I also found time to fuzz the project using a modified version of Rustlantis! My patches enable it to not use the built-in Rust formatter, which means it does not require a fully functional standard lib to operate.

I did not yet have the time to upstream my changes, but I managed to use it to find and fix quite a bit of bugs.

A month ago, the project did not pass any of the 101 tests I generated, but it is now capable of running 39 of them without deviating in any way from the standard Rust compiler. Most of those deviations are caused by differences in float-to-int casts between Rust and .NET (saturating vs wrapping casts), so they should be relatively easy to fix once I finish refactoring the codebase.

With those patches, we are getting closer and closer towards getting Rust code running in .NET!

If you have any questions/suggestions, feel free to ask! I will try to respond as soon as I find some time.