Skip to content

Upgrade Charon to nightly-2026.11.18 - #5158

Merged
feliperodri merged 6 commits into
model-checking:mainfrom
feliperodri:charon-2026.11.12
Nov 18, 2026
Merged

feliperodri merged 6 commits into
model-checking:mainfrom
feliperodri:charon-2026.11.12

Conversation

@feliperodri

@feliperodri feliperodri commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

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 charon submodule, Cargo.lock (Charon's own dependencies), the LLBC backend and its tests change; the CBMC backend is untouched.

Changes

  • Generics. One outlives list replaces regions_outlive/types_outlive; region parameters record whether they are late-bound (as in Charon's translate_generics); region binders carry their outlives predicates (empty, as before).
  • Trait proofs. TraitRef holds a TraitDeclRef without a binder, TraitRefKind::Clause takes region arguments, and generic arguments hold PolyTraitRefs (PolyTraitRef::empty, as Charon does for non-higher-ranked proofs).
  • Copies now carry a proof that the type is Copy. Like the backend's other trait proofs, this is a placeholder (a builtin proof); Kani does not resolve the impl.
  • 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. Charon fills those with conversions in its driver, which Kani does not link, so from_rustc_variant converts through the variant names that Charon mirrors from rustc.
  • Type layouts. TypeDecl records the layouts of its monomorphic instances (monomorphic_layouts). Kani translates monomorphized code, so the map stays empty, as Charon documents for already-monomorphic types.
  • Assert calls. An Assert now 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 for panic_invalid_enum_construction, and none otherwise.
  • Checked arithmetic. Charon removed its operators for AddWithOverflow/SubWithOverflow/MulWithOverflow (AeneasVerif/charon e37849c, "Turn checked binops into intrinsic calls"). Its own translation now emits a call to the *_with_overflow intrinsic, which ends the block, and its reconstruct_fallible_operations pass folds the call and the overflow Assert into 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 mut for mutable locals (every return and anonymous local);
  • option: outlives clauses print as Outlives0: (T: '_0) instead of TypeOutlives0: T: '_0;
  • generic and projection: the new reconstruction drops an unreachable undefined_behavior arm and merges a duplicated exit path. I checked that every other statement is unchanged.

tests/llbc/checked_chain adds a body with three checked operations.

Testing

On nightly-2026-11-18 (from #5188), in the Kani CI image: kani-llbc-regression.sh passes (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 and cargo deny --all-features --workspace check -s pass.

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.

@feliperodri
feliperodri requested review from a team as code owners November 12, 2026 18:12
@feliperodri feliperodri added [C] Internal Tracks some internal work. I.e.: Users should not be affected. dependencies Pull requests that update a dependency file labels Nov 12, 2026
@github-actions github-actions Bot added Z-EndToEndBenchCI Tag a PR to run benchmark CI Z-CompilerBenchCI Tag a PR to run benchmark CI labels Nov 12, 2026
- 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>
@feliperodri feliperodri changed the title Upgrade Charon to nightly-2026.11.12 Upgrade Charon to nightly-2026.11.18 Nov 18, 2026
@feliperodri
feliperodri requested a balanced review from Copilot November 18, 2026 16:30
@feliperodri feliperodri added this to the Charon front end (LLBC) milestone Nov 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 chrono timestamp 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 rajath-mk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@feliperodri
feliperodri added this pull request to the merge queue Nov 18, 2026
Merged via the queue into model-checking:main with commit 4e2cdd9 Nov 18, 2026
34 checks passed
@feliperodri
feliperodri deleted the charon-2026.11.12 branch November 18, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[C] Internal Tracks some internal work. I.e.: Users should not be affected. dependencies Pull requests that update a dependency file Z-CompilerBenchCI Tag a PR to run benchmark CI Z-EndToEndBenchCI Tag a PR to run benchmark CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic Charon upgrade failed

3 participants