dafny-lang / dafny

Dafny is a verification-aware programming language
https://dafny.org
Other
2.94k stars 263 forks source link

Fix: Constant initialization in the Dafny-to-Rust code generator #5837

Closed MikaelMayer closed 1 month ago

MikaelMayer commented 1 month ago

Fixes #5833

Description

There are now three kinds of generated fields:

Before this PR, only the last two were implemented, which lead to issues when trying to assign the default value of a class constant. This issue was not captured because the test started to fail but since it's was marked %testForEachCompiler and these tests are ignored in the CI, we did not detect it.

How has this been tested?

Updated the file classes.dfy. All other tests in comp/rust should pass.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.