Repository navigation
Fix stale signature assertion for the catch_unwind intrinsic - #4819
Conversation
The catch_unwind intrinsic's return type changed from i32 to bool in the pinned toolchain, so the signature assertion in Intrinsic::from_instance caused an ICE whenever the intrinsic was reachable, e.g. through std::panic::catch_unwind or BufReader. Update the assertion to match the new signature. The intrinsic itself remains unimplemented (model-checking#267) and reaching it still reports an unsupported-construct failure, which the new expected test checks. Resolves model-checking#4813
|
Confirming this from the verify-rust-std side, and adding a data point on how far its reach goes. While testing whether #4848 unblocks the autoharness jobs on model-checking/verify-rust-std#687 (the bump to The signature change is exactly as described here. For the record, from // nightly-2026-02-05
pub unsafe fn catch_unwind(
_try_fn: fn(*mut u8),
_data: *mut u8,
_catch_fn: fn(*mut u8, *mut u8),
) -> i32;
// nightly-2026-08-21
pub unsafe fn catch_unwind<Data: ptr::Thin>(
_try_fn: unsafe fn(*mut Data),
_data: *mut Data,
_catch_fn: unsafe fn(*mut Data, *mut u8),
) -> bool;Two notes that may be useful:
Concretely, this PR plus #4848 are both needed before the unfiltered autoharness path ( No changes requested — just flagging that this unblocks more than the |
The test was disabled in the nightly-2026-02-14 upgrade (model-checking#4683) because rustc_public could not convert `ty::PatternKind::NotNull` (used by `NonNull`), making Kani unable to codegen std at all. Its fixme note said to re-enable it once the toolchain reached nightly-2026-04-29, where the conversion was implemented upstream; the toolchain has since moved well past that point without the test being re-enabled. Codegen of the full standard library works again on the current toolchain now that the catch_unwind signature crash is fixed (model-checking#4819), so restore the test to its original name and configuration. Co-authored-by: Kiro <[email protected]>
Re-enable the `script-based-pre/std_codegen` test. It was disabled in the nightly-2026-02-14 upgrade (model-checking#4683) because `rustc_public` could not yet convert `ty::PatternKind::NotNull`; its fixme note said to re-enable it once the toolchain reached nightly-2026-04-29, which has long since happened. The last remaining obstacle to codegen of the entire standard library was the `catch_unwind` intrinsic signature crash, which model-checking#4819 fixed. The test is restored to its original name and configuration. This PR originally also carried the `catch_unwind` fix; that part duplicated model-checking#4819 and was dropped after model-checking#4819 merged. Manual testing: on main e47388f (with model-checking#4819), `cargo run -p compiletest -- --suite script-based-pre --mode exec std_codegen` passes (about 80 s locally). By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. Co-authored-by: Kiro <[email protected]>
…#687) This PR merges library subtree updates from 2026-02-05 (rust-lang/rust@db3e99b) to 2026-09-25 (rust-lang/rust@f7575a9) (inclusive) into main. It was opened automatically for nightly-2026-08-21 and has since been moved forward to nightly-2026-09-25, the toolchain of Kani `main`, which this repository's toolchain is coupled to. Kani is pinned to `main` (1640445d), which carries the autoharness fixes this sync needed (model-checking/kani#4819, rust-lang#4848, rust-lang#4869, rust-lang#4801, rust-lang#4927, rust-lang#4951). Flux is pinned to `main` (849ef7c3, flux-rs/flux#1802). Known open items: - VeriFast proofs for `linked_list.rs` and `raw_vec` conflict with the upstream changes and still need updating. - `Verify contracts with goto-transcoder`: ESBMC segfaults on contracts generated by Kani `main` (model-checking#708). **Do not remove or edit the following annotations:** git-subtree-dir: library git-subtree-split: 066e3de --------- Signed-off-by: Amirhossein Akhlaghpour <[email protected]> Co-authored-by: Ralf Jung <[email protected]> Co-authored-by: Jonathan Brouwer <[email protected]> Co-authored-by: Ben Kimock <[email protected]> Co-authored-by: Roland Xu <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: Amirhossein Akhlaghpour <[email protected]> Co-authored-by: gitbot <git@bot> Co-authored-by: David Carlier <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Max Dexheimer <[email protected]> Co-authored-by: Evgenii Zheltonozhskii <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: ltdk <[email protected]> Co-authored-by: Jacob Pratt <[email protected]> Co-authored-by: ywxt <[email protected]> Co-authored-by: Erica Z <[email protected]> Co-authored-by: Mikhail Baykov <[email protected]> Co-authored-by: Amanieu d'Antras <[email protected]> Co-authored-by: Adam Gemmell <[email protected]> Co-authored-by: Jakub Beránek <[email protected]> Co-authored-by: xonx <[email protected]> Co-authored-by: WANG Rui <[email protected]> Co-authored-by: Jonathan Keller <[email protected]> Co-authored-by: Felipe R. Monteiro <[email protected]> Co-authored-by: The Miri Cronjob Bot <[email protected]> Co-authored-by: Shun Sakai <[email protected]> Co-authored-by: Joel-Wwalker <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Zachary S <[email protected]> Co-authored-by: Stuart Cook <[email protected]> Co-authored-by: nodamushi <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: yilin <[email protected]> Co-authored-by: Sergey "Shnatsel" Davidoff <[email protected]> Co-authored-by: The rustc-josh-sync Cronjob Bot <[email protected]> Co-authored-by: tangaac <[email protected]> Co-authored-by: Karl Meakin <[email protected]> Co-authored-by: kianalikasana <[email protected]> Co-authored-by: yvz <[email protected]> Co-authored-by: Clar Fon <[email protected]> Co-authored-by: Alice Ryhl <[email protected]> Co-authored-by: Jason Gerard DeRose <[email protected]> Co-authored-by: Cameron Steffen <[email protected]> Co-authored-by: Oleksandr Babak <[email protected]> Co-authored-by: Bart Jacobs <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: James Barford-Evans <[email protected]> Co-authored-by: Brad Smith <[email protected]> Co-authored-by: asquared31415 <[email protected]> Co-authored-by: mejrs <[email protected]> Co-authored-by: Alex Crichton <[email protected]> Co-authored-by: malezjaa <[email protected]> Co-authored-by: Nia Deckers <[email protected]> Co-authored-by: Zac Harrold <[email protected]> Co-authored-by: Amar Shah <[email protected]> Co-authored-by: khyperia <[email protected]> Co-authored-by: Boxy <[email protected]> Co-authored-by: David Wood <[email protected]> Co-authored-by: Srivatsan Samraj <[email protected]> Co-authored-by: Srivatsan Samraj <[email protected]>
`Intrinsic::from_instance` maps `catch_unwind` to `Unimplemented` (model-checking#267) but first asserts its exact signature, return type included. rustc owns that type and already changed it once (rust-lang/rust#156867, i32 -> bool). Kani's stale `i32` pin shipped in 0.68.0 and panicked on every program that reached the intrinsic (model-checking#4813), until model-checking#4819 re-pinned it to `bool`. The arm never reads the return type, so pinning it only guarantees another one-line fix on the next upstream change. Match it with `_`, as the `bitreverse`, `black_box`, `discriminant_value` and `*_fast` arms already do. The argument patterns and the arity check are unchanged, so a structural change upstream still trips the assertion. No behaviour change: reaching `catch_unwind` still fails verification with the unsupported-construct message, as `tests/expected/intrinsics/catch-unwind` checks.
Kani 0.68.0 ICEs on anything that reaches `catch_unwind`: rustc changed the intrinsic's return type from `i32` to `bool` (rust-lang/rust#156867) and `assert_sig_matches!` still said `i32`. model-checking#4819 changed it to `bool` (model-checking#4813). The intrinsic is `Unimplemented` (model-checking#267) and the arm never looks at the return type, so stop asserting it (`=> _`, like `bitreverse`, `black_box`, `discriminant_value` and the `*_fast` arms). Next time rustc changes it the user gets the unsupported-construct failure instead of an ICE. Arguments and arity are still asserted. Covered by tests/expected/intrinsics/catch-unwind from model-checking#4819.
…-checking#4996) Kani 0.68.0 ICEs on anything that reaches `catch_unwind` (`std::panic::catch_unwind`, `thread::spawn(..).join()`, `BufReader`): ``` thread 'rustc' panicked at kani-compiler/src/intrinsics.rs:243:17: assertion failed: matches!(output.kind(), TyKind :: RigidTy(RigidTy::Int(IntTy::I32))) ``` rustc changed the intrinsic's return type from `i32` to `bool` in rust-lang/rust#156867 and the `assert_sig_matches!` in `Intrinsic::from_instance` still said `i32`. model-checking#4819 changed it to `bool` (model-checking#4813). The intrinsic is `Unimplemented` (model-checking#267) and the arm never looks at the return type, so this PR stops asserting it: `=> _`, like `bitreverse`, `black_box`, `discriminant_value` and the `*_fast` arms. Next time rustc changes it, the user gets `catch_unwind is not currently supported by Kani` instead of an ICE. Arguments and arity are still asserted. Covered by `tests/expected/intrinsics/catch-unwind` from model-checking#4819. Co-authored-by: Felipe R. Monteiro <[email protected]>
The
catch_unwindintrinsic's return type changed fromi32toboolin the pinned toolchain (nightly-2026-08-21), so the signature assertion inIntrinsic::from_instancecaused an ICE whenever the intrinsic was reachable, e.g. throughstd::panic::catch_unwindorBufReaderundercargo kani autoharness.This PR updates the assertion to match the new signature. The intrinsic itself remains unimplemented (#267): reaching it still reports an unsupported-construct verification failure, which the new expected test pins down (instead of the previous compiler crash).
Testing
tests/expected/intrinsics/catch-unwind(ICEs without the fix; reportscatch_unwind is not currently supported by Kaniwith it).cargo kani autoharness -Z autoharnesson theBufReaderexample) compiles and verifies without an ICE.Resolves #4813
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.