creusot-rs / creusot

Creusot helps you prove your code is correct in an automated fashion.
GNU Lesser General Public License v2.1
1.11k stars 51 forks source link

Why3 error: unexpected 'variant' clause #205

Open sarsko opened 2 years ago

sarsko commented 2 years ago

When figuring out the proof, it is sometimes useful to add #[trusted] temporarily. If that function has a #[variant] attached, Why3 will give the following error: unexpected 'variant' clause

Example:

#[trusted]
#[variant(0)]
fn ex() {
}
xldenis commented 2 years ago

Ah yes, i understand why this happens but we should just silently swallow the variant instead.

jhjourdan commented 2 years ago

Could we emit a warning instead? I understand that you may want to do this, but having a variant clause on a trusted function is not something that one would do in a final piece of code.

xldenis commented 2 years ago

Could we emit a warning instead? I understand that you may want to do this, but having a variant clause on a trusted function is not something that one would do in a final piece of code.

Yes definitely.