epfl-lara / rust-stainless

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

Erase all Clone calls & impls #124

Closed yannbolliger closed 3 years ago

yannbolliger commented 3 years ago

To clone a type in Rust, it must have an implementation of std::clone::Clone, which is usually derived from a macro. The derived implementation recursively clones the fields of a type. So, by default, the clone operation preserves equality. However, that is impossible for Stainless to understand because the behaviour is provided by two different type classes (Clone and PartialEq) that have no type or parameter dependency.

As a first step to deal with the problem, this PR proposes to erase:

To do

This allows progress on some benchmarks but is not sound in all cases. Details can be found in #136.