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

Unsoundness in util::update #41

Closed
dfoxfranke opened this issue Apr 30, 2024 · 1 comment · Fixed by #42
Closed

Unsoundness in util::update #41

dfoxfranke opened this issue Apr 30, 2024 · 1 comment · Fixed by #42

Comments

@dfoxfranke
Copy link

ascent_base::util::update is unsound, because the value will be left in an inconsistent state if the update function panics.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8483c2bae0a8e0aa486d7bdf2fe1e780

The crate replace_with provides a safe way to implement this idiom.

@s-arash
Copy link
Owner

s-arash commented May 1, 2024

Thanks for bringing up the issue! I'll either follow your suggestion and use replace_with instead of update, or change impls of Lattice to not need to call update at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants