ascent
ascent copied to clipboard
Unsoundness in `util::update`
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.
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.