Repository navigation
Update Charon submodule to v0.1.91 - #4714
Conversation
Advance the Charon pin from v0.1.88 (607f5683) to v0.1.91 (b250680a), continuing the incremental effort to catch the pinned Charon up with upstream (the endgame is dropping scripts/charon-patch.diff entirely). Charon v0.1.89-91 make `Body` carry its blocks in a `BodyContents` vector and introduce an explicit unwind-continuation block id on ULLBC bodies. Kani appends its synthetic "unwinding aborts" block after the translated blocks and assigns its id before translating them (the id equals the MIR block count), keeping all block-id targets stable. Refresh scripts/charon-patch.diff so its hunks apply against the v0.1.91 sources (context-line drift only; the patch content is unchanged). Co-authored-by: Kiro <[email protected]>
There was a problem hiding this comment.
Pull request overview
Updates Kani’s pinned Charon version to v0.1.91 and adjusts the Aeneas/ULLBC MIR translation to match upstream representation changes (notably the explicit unwind continuation and BodyContents-backed blocks). The accompanying Charon patch file is refreshed so it applies cleanly to the new upstream sources.
Changes:
- Bump Charon dependency from v0.1.88 to v0.1.91 (lockfile update).
- Update MIR→ULLBC translation to pre-assign and reference a synthetic unwind-abort block via
on_unwind. - Refresh
scripts/charon-patch.diffhunk context for Charon v0.1.91.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/charon-patch.diff | Refresh patch context so it applies to Charon v0.1.91 sources. |
| kani-compiler/src/codegen_aeneas_llbc/mir_to_ullbc/mod.rs | Add/track a synthetic unwind block and wire it into translated call terminators. |
| kani-compiler/src/codegen_aeneas_llbc/compiler_interface.rs | Adjust TranslateOptions initialization to match upstream option struct changes. |
| Cargo.lock | Update locked charon crate version to 0.1.91. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses the review comment on `translate_terminator`: `target.unwrap()`
turned any program containing a call to a diverging function into a
compiler crash. That covers `panic!`, `std::process::exit`, and any
`-> !` function:
fn diverge() -> ! { loop {} }
#[kani::proof]
fn main() { diverge(); }
thread 'rustc' panicked at
kani-compiler/src/codegen_aeneas_llbc/mir_to_ullbc/mod.rs:1600:66
MIR gives such a `Call` no return target, while ULLBC requires one, so the
normal-return edge now points at the synthetic abort block. Control cannot
reach it, and aborting if it somehow did matches how the CBMC backend
already models this case, where `codegen_end_call` emits a sanity check
reading "Unexpected return from Never function".
Since that block is now the target of two different edges -- every call's
unwind edge and the return edge of calls that never return -- it is renamed
from `unwind_block` to `abort_block`, because a field named for unwinding
being used as a call's *return* target reads like a bug.
The regression test asserts on the translated output rather than merely
running, because an empty `expected` file is satisfied by a crash: the
expected-output matcher only looks for containment, so the test passed
either way until it had something to match. Verified it fails against the
previous code with the panic above and passes with the fix.
Full `llbc` suite: 10 passed. The module is behind `#[cfg(feature = "llbc")]`,
so nothing outside the Lean backend is affected.
|
The fix fully handles |
| pub fn test::diverge() -> !\ | ||
| {\ | ||
| let @0: !; // return | ||
| pub fn test::main() |
Advance the Charon pin from v0.1.88 (607f5683) to v0.1.91 (b250680a), continuing the incremental effort to catch the pinned Charon up with upstream (the endgame is dropping scripts/charon-patch.diff entirely).
Charon v0.1.89-91 make
Bodycarry its blocks in aBodyContentsvector and introduce an explicit unwind-continuation block id on ULLBC bodies. Kani appends its synthetic "unwinding aborts" block after the translated blocks and assigns its id before translating them (the id equals the MIR block count), keeping all block-id targets stable.Refresh scripts/charon-patch.diff so its hunks apply against the v0.1.91 sources (context-line drift only; the patch content is unchanged).
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.