-
Notifications
You must be signed in to change notification settings - Fork 52
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
Incorrect support for two-phase borrows #668
Comments
Minified example: extern crate creusot_contracts;
use creusot_contracts::*;
/// A vacant Entry.
pub struct VacantEntry<'a, K>
where
K: Ord + Eq,
{
map: &'a mut Vec<K>,
key: K,
index: usize,
}
impl<K> VacantEntry<'_, K>
where
K: Ord + Eq + Clone + DeepModel,
K::DeepModelTy: OrdLogic,
{
pub fn insert(&mut self) {
self.map.insert(self.index, self.key.clone())
}
} |
That should not be very hard to debug. Basically, Creusot uses the same temporary variable for |
Is this an instance of #1239 ? |
Probably. But could you please check this specific test case is still an issue? |
Yes, the error still happens. |
Looking at the coma code generated, this does not seem to be related to #1239. I don't know where this comes from, but this can probably be used for unsoundness. |
The bug is in |
More generally, our handling of two-phase borrows is broken. |
After discussions, it seems that a solution would be to delay the creation of the prophecy a the activation point of two phases borrows : at this point, the borrowed place should not have moved, and the borrow should not have been used yet. |
@jhaye reports that the following code creates ill typed why3 code.
The text was updated successfully, but these errors were encountered: