Commit d96e3e7
committed
Enable contracts for const functions
Use `const_eval_select!()` macro to enable contract checking only at
runtime. The existing contract logic relies on closures,
which are not supported in constant functions.
This commit also removes one level of indirection for ensures clauses,
however, it currently has a spurious warning message when the bottom
of the function is unreachable.1 parent 35672c7 commit d96e3e7
3 files changed
+47
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
| 14 | + | |
12 | 15 | | |
13 | | - | |
| 16 | + | |
14 | 17 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 18 | + | |
20 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3450 | 3450 | | |
3451 | 3451 | | |
3452 | 3452 | | |
3453 | | - | |
| 3453 | + | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
3454 | 3457 | | |
3455 | 3458 | | |
3456 | | - | |
3457 | | - | |
3458 | | - | |
3459 | | - | |
3460 | | - | |
| 3459 | + | |
| 3460 | + | |
| 3461 | + | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
3461 | 3471 | | |
3462 | 3472 | | |
3463 | 3473 | | |
3464 | 3474 | | |
3465 | 3475 | | |
3466 | 3476 | | |
| 3477 | + | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
| 3486 | + | |
| 3487 | + | |
| 3488 | + | |
| 3489 | + | |
| 3490 | + | |
| 3491 | + | |
| 3492 | + | |
| 3493 | + | |
| 3494 | + | |
| 3495 | + | |
| 3496 | + | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
3467 | 3502 | | |
3468 | 3503 | | |
3469 | 3504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
0 commit comments