epfl-lara / rust-stainless

An experimental Rust frontend for Stainless
Apache License 2.0
6 stars 2 forks source link

Support mutable generics and remove var flag #158

Closed yannbolliger closed 3 years ago

yannbolliger commented 3 years ago

This PR is the result of many discussions with @romac @gsps @vkuncak. There was also great support by @jad-hamza on the Stainless side of things, thanks!

The PR brings the mutability support of rust-stainless closer to Rust's semantics by dropping the var annotation on fields.

Closes #157. Closes #99 because now, all fields can be mutated with mut at binding. This is a big step for #92 and brings us closer to #140.

Theory The safety of what we do in this PR, mainly on this single line change is guaranteed by the following theoretical argument:

There are 3 other places, where freshCopy is/was introduced:

yannbolliger commented 3 years ago

This is now finished, CI will pass once the latest stainless-noxt is published. @gsps @romac please review. 🙏

yannbolliger commented 3 years ago

Closing in favour of #164. Most of the changes here are contained there.