Commit 3736d54
Fix Layout::repeat contract and f128->i128 harness failures
Two harness failures surfaced in CI once compilation was fixed:
* alloc::layout::verify::check_repeat: rust-lang#148769 changed
Layout::repeat to not include padding after the trailing element, so
on success the resulting size is (n - 1) * stride + self.size()
rather than n * stride. Our postcondition size >= stride is thus
violated for n == 1 whenever self needs padding (e.g. size 6, align
4: size 6 < stride 8). Update the exact (non-kani) postconditions to
the new semantics and weaken the Kani-checkable variant to n <= 1 ||
size >= stride.
* num::verify::checked_f128_to_int_unchecked_i128: Kani's f128 -> i128
lower bound in float_to_int_in_range is unsound (-2^128 instead of
-(2^127 + 2^15)), so the contract instrumentation admits values that
truncate below i128::MIN; the CBMC 6.10 upgrade in the new Kani pin
exposed this (previously such conversions happened to saturate the
same way as the 'as' oracle). Reported as
model-checking/kani#4662, fix proposed in
model-checking/kani#4663. Until that fix is
in the pinned Kani version, hand-write this harness with an explicit
sound input range.
Verified locally with the pinned Kani commit: both harnesses pass, and
'cargo check -p core' stays clean.
Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>1 parent a855779 commit 3736d54
2 files changed
Lines changed: 31 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
464 | | - | |
465 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
466 | 469 | | |
467 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
468 | 473 | | |
469 | 474 | | |
470 | | - | |
471 | | - | |
472 | 475 | | |
473 | | - | |
474 | | - | |
| 476 | + | |
475 | 477 | | |
476 | | - | |
| 478 | + | |
477 | 479 | | |
478 | 480 | | |
479 | 481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2175 | 2175 | | |
2176 | 2176 | | |
2177 | 2177 | | |
2178 | | - | |
2179 | | - | |
2180 | 2178 | | |
2181 | 2179 | | |
2182 | 2180 | | |
| |||
2192 | 2190 | | |
2193 | 2191 | | |
2194 | 2192 | | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
2195 | 2214 | | |
0 commit comments