Repository navigation
Upgrade Charon to nightly-2026.11.18 - #5158
Conversation
- rustc removed Attribute::path_matches and Attribute::value_str: Kani now checks the path of tool attributes and reads their string values itself. - HumanReadableErrorType gained a no_graphics field. - The new TyKind::View (view types, which rustc's own codegen does not support yet) is reported as unsupported. - copysign, maximum_number_nsz and minimum_number_nsz are now generic over the float type, like ceil and sqrt before them: Kani keeps its own f32/f64 models for them. - MIR no longer allows projecting into SIMD types (MCP#838): the CustomMask test model copies itself instead of deriving Clone and Debug. - The pattern_type_macro feature gate was removed; pattern_type! is gated by pattern_types. - Fix the new clippy unnecessary_to_owned findings. Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
RUSTSEC-2026-0543 marks chrono as unmaintained, with no fixed version, so cargo deny fails. kani-driver only used it to stamp the flamegraph file name in developer mode. Build that timestamp from std::time::SystemTime instead (in UTC), with a unit test. Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
The automated Charon upgrade has failed since nightly-2026.10.27 (model-checking#5086). The LLBC backend changes for Charon's AST changes since nightly-2026.10.13: - Generic parameters: one `outlives` list replaces `regions_outlive` and `types_outlive`; region parameters record whether they are late-bound; region binders carry their outlives predicates. - Trait proofs: `TraitRef` holds a `TraitDeclRef` (no binder), `TraitRefKind::Clause` takes region arguments, and generic arguments hold `PolyTraitRef`s. - Copies carry a proof that the type is `Copy`. Like the backend's other trait proofs, this is a placeholder (a builtin proof). - Locals record their mutability (printed as `let mut`) and borrow-check constraints; a call's destination moved to the `Call` terminator; `TargetInfo` records the target's architecture, OS, environment, ABI, families and binary format, converted through Charon's variant names. - Charon no longer has operators for the checked operations, which return `(result, overflowed)`; its own translation emits a call to the `add_with_overflow`/`sub_with_overflow`/`mul_with_overflow` intrinsic, which ends the block, and folds it with the following overflow `Assert` into a panicking operation. Do the same: split the MIR block after each checked operation, numbering the new blocks after the abort block, and declare the intrinsic as Charon does (`Body::Intrinsic`). - rustc no longer emits `Rvalue::Len`, which Charon removed. - Type declarations record the layouts of their monomorphic instances; Kani translates monomorphized code, so that map stays empty. - An `Assert` records the call to the panicking function that runs when the check fails (Charon PR model-checking#1606). Use the lang item rustc calls for each check (`AssertKind::panic_function`), with the same arguments as Charon's own translation. The LLBC expected outputs change only where Charon's printer and control-flow reconstruction changed: `let mut` for mutable locals, outlives clauses printed as `Outlives0: (T: '_0)`, and in `generic` and `projection` unreachable arms removed and duplicated exit paths merged. `tests/llbc/checked_chain` covers several checked operations in one body. Resolves model-checking#5086 Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
5be33ab to
57785dd
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain: a user-defined core module can cause checked-arithmetic translation to panic, and surviving assertions can reference undeclared panic functions, leaving LLBC incomplete.
2 open issues
What changed in this PR
Upgrades Charon to nightly-2026.11.18 and adapts Kani’s experimental LLBC backend to its updated AST, addressing #5086. This PR depends on #5188, whose Rust toolchain changes are also included in the reviewed diff.
Changes:
- Update LLBC generics, trait proofs, locals, target metadata, and assertion calls for Charon’s new representations.
- Translate checked arithmetic through overflow intrinsics with block splitting, refresh expected outputs, and add a chained-arithmetic regression.
- Include prerequisite nightly compatibility updates and replace the driver’s
chronotimestamp usage.
| File | Description |
|---|---|
tools/scanner/src/bin/scan.rs |
Avoid allocation when checking verbose arguments. |
tests/script-based-pre/autoharness_pattern_type/pattern_type_probe.rs |
Remove the obsolete feature gate. |
tests/script-based-pre/autoharness_niche/niche_probe.rs |
Remove the obsolete gate while preserving line numbers. |
tests/llbc/unops/expected |
Update mutable-local output. |
tests/llbc/tuple/expected |
Update mutable-local output. |
tests/llbc/traitimpl/expected |
Update mutable-local output. |
tests/llbc/switch_int/expected |
Update mutable-local output. |
tests/llbc/struct/expected |
Update mutable-local output. |
tests/llbc/shifts/expected |
Update mutable-local output. |
tests/llbc/projection/expected |
Refresh mutability and reconstructed control flow. |
tests/llbc/option/expected |
Refresh outlives predicates and mutability. |
tests/llbc/int_literals/expected |
Update mutable-local output. |
tests/llbc/inherent_local/expected |
Update mutable-local output. |
tests/llbc/inherent_core/expected |
Update mutable-local output. |
tests/llbc/generic/expected |
Refresh mutability and reconstructed control flow. |
tests/llbc/enum/expected |
Update mutable-local output. |
tests/llbc/diverging_call/expected |
Update mutable-local output. |
tests/llbc/div_rem/expected |
Update mutable-local output. |
tests/llbc/checked_chain/test.rs |
Add a chained checked-arithmetic regression. |
tests/llbc/checked_chain/expected |
Record reconstructed arithmetic output. |
tests/llbc/bool_char/expected |
Update mutable-local output. |
tests/llbc/basic1/expected |
Update mutable-local output. |
tests/llbc/basic0/expected |
Update mutable-local output. |
tests/llbc/arith_wrapping/expected |
Update mutable-local output. |
tests/llbc/arith_unchecked/expected |
Update mutable-local output. |
tests/llbc/arith_checked/expected |
Update mutable-local output. |
tests/kani/Intrinsics/MinNum/minnumf64.rs |
Use the generic minimum intrinsic. |
tests/kani/Intrinsics/MinNum/minnumf32.rs |
Use the generic minimum intrinsic. |
tests/kani/Intrinsics/MaxNum/maxnumf64.rs |
Use the generic maximum intrinsic. |
tests/kani/Intrinsics/MaxNum/maxnumf32.rs |
Use the generic maximum intrinsic. |
tests/kani/Intrinsics/CopySign/copysignf64.rs |
Update intrinsic calls and explanatory comments. |
tests/kani/Intrinsics/CopySign/copysignf32.rs |
Update intrinsic calls and explanatory comments. |
tests/expected/valid-value-checks/place_access_pattern.rs |
Remove the obsolete feature gate. |
tests/expected/valid-value-checks/custom_niche.rs |
Remove the obsolete gate while preserving line numbers. |
rust-toolchain.toml |
Pin Rust to nightly-2026-11-18. |
library/kani/src/models/mod.rs |
Avoid disallowed SIMD field projections in derives. |
kani-driver/src/session.rs |
Generate UTC timestamps using std, with tests. |
kani-driver/src/concrete_playback/playback.rs |
Avoid allocation when checking playback arguments. |
kani-driver/Cargo.toml |
Remove the chrono dependency. |
kani-compiler/src/session.rs |
Supply rustc’s new diagnostic option. |
kani-compiler/src/kani_middle/transform/loop_contracts.rs |
Avoid allocation in feature checks. |
kani-compiler/src/kani_middle/transform/contracts.rs |
Avoid allocation in feature checks. |
kani-compiler/src/kani_middle/attributes.rs |
Replace removed rustc attribute APIs. |
kani-compiler/src/intrinsics.rs |
Map newly generic float intrinsics to Kani models. |
kani-compiler/src/codegen_cprover_gotoc/overrides/hooks.rs |
Avoid allocation in loop-contract feature checks. |
kani-compiler/src/codegen_cprover_gotoc/context/current_fn.rs |
Use the replacement attribute-value helper. |
kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs |
Explicitly reject unsupported view types. |
kani-compiler/src/codegen_cprover_gotoc/codegen/statement.rs |
Avoid allocation in loop-contract feature checks. |
kani-compiler/src/codegen_cprover_gotoc/codegen/function.rs |
Avoid allocation in loop-contract feature checks. |
kani-compiler/src/codegen_cprover_gotoc/codegen/foreign_function.rs |
Avoid allocation in C-FFI feature checks. |
kani-compiler/src/codegen_aeneas_llbc/mir_to_ullbc/mod.rs |
Adapt AST translation, panic calls, and checked arithmetic. |
kani-compiler/Cargo.toml |
Enable serde with the LLBC feature. |
Cargo.lock |
Refresh Charon dependencies and remove unused packages. |
Review effort: Balanced
… panic functions - Look up the *_with_overflow intrinsics as ::core::intrinsics::*, so a crate that defines its own mod core no longer makes every checked operation fail to resolve. tests/llbc/checked_shadowed_core covers this. - An Assert's panic function is not collected by reachability, and translate_fn_ptr only reserves its id. Declare it with an opaque body, as the backend does for built-in functions, so the LLBC no longer refers to an undeclared function. Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
rajath-mk
left a comment
There was a problem hiding this comment.
Ran kani-llbc-regression.sh on this head: fmt, the -D warnings build and clippy pass, and the LLBC suite is 25/25, including checked_chain and checked_shadowed_core (on aarch64 I needed a local target_config workaround for the existing neon error, unrelated to this PR). The MaxNum/MinNum tests touched by the toolchain bump pass too. Looks good.

Depends on #5188 (the toolchain upgrade to nightly-2026-11-18): this branch is on top of it, so only the last commit, "Upgrade Charon to nightly-2026.11.18", is new here. It should merge after #5188.
The automated Charon upgrade has failed since nightly-2026.10.27 (#5086). This moves the pin from nightly-2026.10.13 to nightly-2026.11.18 and updates the LLBC backend for Charon's AST changes in between. Only the
charonsubmodule,Cargo.lock(Charon's own dependencies), the LLBC backend and its tests change; the CBMC backend is untouched.Changes
outliveslist replacesregions_outlive/types_outlive; region parameters record whether they are late-bound (as in Charon'stranslate_generics); region binders carry their outlives predicates (empty, as before).TraitRefholds aTraitDeclRefwithout a binder,TraitRefKind::Clausetakes region arguments, and generic arguments holdPolyTraitRefs (PolyTraitRef::empty, as Charon does for non-higher-ranked proofs).Copy. Like the backend's other trait proofs, this is a placeholder (a builtin proof); Kani does not resolve the impl.let mut) and borrow-check constraints; a call's destination moved to theCallterminator;TargetInforecords the target's architecture, OS, environment, ABI, families and binary format. Charon fills those with conversions in its driver, which Kani does not link, sofrom_rustc_variantconverts through the variant names that Charon mirrors from rustc.TypeDeclrecords the layouts of its monomorphic instances (monomorphic_layouts). Kani translates monomorphized code, so the map stays empty, as Charon documents for already-monomorphic types.Assertnow records the call to the panicking function that runs when the check fails (Charon PR Ship custom sysroot #1606). The backend uses the lang item rustc calls for each check (AssertKind::panic_function), with the arguments Charon's own translation passes:panic_bounds_check(index, len),panic_misaligned_pointer_dereference(required, found), the invalid enum value forpanic_invalid_enum_construction, and none otherwise.AddWithOverflow/SubWithOverflow/MulWithOverflow(AeneasVerif/charone37849c, "Turn checked binops into intrinsic calls"). Its own translation now emits a call to the*_with_overflowintrinsic, which ends the block, and itsreconstruct_fallible_operationspass folds the call and the overflowAssertinto a panicking operation. The backend does the same: it splits the MIR block after each checked operation (the new blocks are numbered after the abort block, so every MIR block keeps its ID) and declares the intrinsic as Charon does (Body::Intrinsic). The output is unchanged:copy a panic.+ copy b.Rvalue::Len, which rustc no longer emits, is unreachable; Charon removed it.LLBC expected outputs
They change only where Charon's printer and control-flow reconstruction changed:
let mutfor mutable locals (every return and anonymous local);option: outlives clauses print asOutlives0: (T: '_0)instead ofTypeOutlives0: T: '_0;genericandprojection: the new reconstruction drops an unreachableundefined_behaviorarm and merges a duplicated exit path. I checked that every other statement is unchanged.tests/llbc/checked_chainadds a body with three checked operations.Testing
On
nightly-2026-11-18(from #5188), in the Kani CI image:kani-llbc-regression.shpasses (the LLBC build and clippy with-D warnings, 24 expected tests and the cargo suite);cargo build-dev,kani-fmt.sh --check, the workspace clippy commands andcargo deny --all-features --workspace check -spass.Resolves #5086
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.