blob: 7876581729361e8adfefdf6d0e2a077e7d2b4d1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
//@ [fstar] aeneas-args=-decreases-clauses -split-files
//@ [coq] aeneas-args=-use-fuel
#![feature(register_tool)]
#![register_tool(charon)]
#![register_tool(aeneas)]
#[charon::rename("BoolTest")]
pub trait BoolTrait {
// Required method
#[charon::rename("getTest")]
fn get_bool(&self) -> bool;
// Provided method
#[charon::rename("retTest")]
fn ret_true(&self) -> bool {
true
}
}
#[charon::rename("BoolImpl")]
impl BoolTrait for bool {
fn get_bool(&self) -> bool {
*self
}
}
#[charon::rename("BoolFn")]
pub fn test_bool_trait<T>(x: bool) -> bool {
x.get_bool() && x.ret_true()
}
#[charon::rename("TypeTest")]
type Test = i32;
#[charon::rename("VariantsTest")]
enum SimpleEnum {
#[charon::rename("Variant1")]
FirstVariant,
SecondVariant,
ThirdVariant,
}
#[charon::rename("StructTest")]
struct Foo {
#[charon::rename("FieldTest")]
field1: u32,
}
#[charon::rename("Const_Test")]
const C: u32 = 100 + 10 + 1;
#[aeneas::rename("Const_Aeneas11")]
const CA: u32 = 10 + 1;
#[charon::rename("Factfn")]
fn factorial(n: u64) -> u64 {
if n <= 1 {
1
} else {
return n * factorial(n - 1);
}
}
#[charon::rename("No_borrows_sum")]
pub fn sum(max: u32) -> u32 {
let mut i = 0;
let mut s = 0;
while i < max {
s += i;
i += 1;
}
s *= 2;
s
}
|