-
Notifications
You must be signed in to change notification settings - Fork 57
How to specify a crate without verify it? #1427
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
Comments
I already anticipated this issue, but I don't have a good solution. Ideally, I would prefer the C1-creusot approach, that let us avoid modifying crate C1. But the main problem here is that the orphans rule won't let us implement e.g., So we are left with a few somewhat non-satisfying solutions (suggestions welcome):
|
Crates sometimes have a mechanism for "remote derives" maybe we could copy that? |
Indeed, I also searched for a way to disable this rule but I guess it is impossible by design and unlikely to change in the future.
Awesome! I was looking for this feature! I used |
I'll leave the issue open, because it corresponds to a real problem, but as we don't really have a solution, we probably won't do anything soon. |
Sure, your workaround with |
The workaround with
After turning on the trace messages, Creusot outputs:
From my understanding, the macro impl<Args: Tuple, F: FnMut<Args>> FnMutExt<Args> for F {
#[predicate(prophetic)]
#[open]
#[allow(unused_variables)]
#[rustc_diagnostic_item = "fn_mut_impl_postcond"]
fn postcondition_mut(self, args: Args, result_state: Self, result: Self::Output) -> bool {
true /* Dummy */
}
... Therefore, Creusot implements this trait for |
Indeed, there is a generic instance of I think I understand what is causing this error: it seems like Creusot is searching for the |
(Using |
Sure,
|
I don't understand too, as all the occurrences of Besides, I have a question. Is there a way to exclude the code generated by macros from the verification? |
I'm preparing a fix.
Not really. IT's not clear what that would mean, because the expansion of the macro is part of the AST which is verified, so we need to make it transparent. |
Could you please check once #1428 is merged? |
Let's imagine you have a crate, says C1, and you want to specify it. However, you do not want to verify the crate.
I proceed as follows:
creusot-contracts
as a dependency of C1.specs
module that contains the specification (some implementations ofView
andDeepModels
andextern_spec
macro calls).Now, suppose you want to use these specifications in another crate, says C2, and verify C2. So you add C1 with Creusot's specifications as a dependency of C2.
However, running
cargo creusot prove
in C2 will attempt to verify C1 too. In particular, it will try to emit Coma files for all C1, which is impossible because C1 contains features unsupported by Creusot. This is why I want to axiomatize C1 instead.A straightforward workaround is to create a new crate, C1-creusot, that depends on both C1 and
creusot-contracts
. But I need to implement Creusot's traits on types of C1, which cannot be done in C1-creusot.The only solution I found so far is to put my specifications in Creusot itself.
Any suggestions?
The text was updated successfully, but these errors were encountered: