Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Ability to emit sync-compatible Rust code. #6040

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

MikaelMayer
Copy link
Member

@MikaelMayer MikaelMayer commented Jan 10, 2025

Fixes #5969

What was changed?

  • I added a new Rust-specific option --rust-sync, set to false by default. When turned on, all the generated code uses std::sync::Arc instead of std::rc::Rc. Nothing else is normally needed for generated code.
  • The option --include-runtime=true now emits the runtime when translating to Rust.
  • I added a new feature for the dafny runtime which is feature = "sync", enabling or disabling some functions via #[cfg(feature = "sync")] and #[cfg(not(feature = "sync"))]. Regular tests don't use this feature.
  • I ran cargo fmt on the runtime.

How has this been tested?

  • A test comp/rust/arc/tokiouser.dfy uses this option and the runtime with the sync feature, compiled with --rust-sync

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

@MikaelMayer MikaelMayer added the run-integration-tests Forces running the CI for integration tests even if the deep tests fail label Jan 10, 2025
@MikaelMayer
Copy link
Member Author

TODO: We need to downcast objects as well. Downcast requires send and sync but it's not implemented for objects for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-integration-tests Forces running the CI for integration tests even if the deep tests fail
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Dafny-to-Rust to emit Arc instead of Rc
2 participants