FStarLang / karamel

KaRaMeL is a tool for extracting low-level F* programs to readable C code
Apache License 2.0
394 stars 58 forks source link

Infer mutability of borrows during Rust extraction #449

Closed R1kM closed 1 month ago

R1kM commented 1 month ago

This PR, done jointly with @msprotz, improves the Rust backend by avoiding needless mutable borrows each time a value is borrowed.

A detailed explanation of the compilation scheme is provided at the top of lib/OptimizeMiniRust.ml. However, the core idea is the following:

In addition to the unit tests added in Rust7.fst, the currently supported part of HACL-rs also extracts, compiles, and passes tests with this PR.