Skip to content

Upgrade Rust toolchain to nightly-2026-11-18 - #5188

Merged
feliperodri merged 5 commits into
model-checking:mainfrom
feliperodri:toolchain-2026-11-17
Nov 18, 2026
Merged

feliperodri merged 5 commits into
model-checking:mainfrom
feliperodri:toolchain-2026-11-17

Conversation

@feliperodri

@feliperodri feliperodri commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Upgrades the toolchain from nightly-2026-11-12 to nightly-2026-11-18. All the changes below came with nightly-2026-11-17; nightly-2026-11-18 needed none.

Changes for the new toolchain

  • Attributes. rustc removed Attribute::path_matches and Attribute::value_str. attributes.rs now checks a tool attribute's path itself (attr_path_matches, the same test rustc used to do) and reads a path = "value" attribute's string through value_lit (attr_value_str).
  • Diagnostics. HumanReadableErrorType gained a no_graphics field.
  • View types. rustc added TyKind::View, a work-in-progress feature that rustc's own codegen and const-eval do not support yet (unimplemented!()). Kani reports it as unsupported in the two type matches in typ.rs, as it does for UnsafeBinder.
  • Float intrinsics. copysign, maximum_number_nsz and minimum_number_nsz are now generic over the float type, as ceil, sqrt and others became before. They join GENERIC_FLOAT_INTRINSICS, so Kani keeps its own f32/f64 models; the six tests call the generic intrinsics.
  • SIMD types. MIR no longer allows field projections into #[repr(simd)] types (MCP#838). The derived Clone/Debug of the CustomMask test model in library/kani projected into its field and made clippy hit an ICE in MIR validation; it now copies the whole value. All SIMD tests in the regression pass unchanged.
  • Feature gates. pattern_type_macro was removed; pattern_type! is gated by pattern_types. Four tests drop the old gate (a comment keeps the line numbers their expected output refers to).
  • Clippy. Nine .contains(&"...".to_string()) calls flagged by the new unnecessary_to_owned finding use .iter().any(..).

Removing chrono

RUSTSEC-2026-0543 (issued 2026-11-17) marks chrono as unmaintained, with no fixed version, so cargo deny fails on every PR and on main. kani-driver only used it to stamp the flamegraph file name in developer mode; that timestamp is now built from std::time::SystemTime (in UTC), with a unit test. This removes chrono and its time-zone crates from Cargo.lock.

Testing

On Linux with CBMC 6.11.0, in the Kani CI image:

  • cargo build-dev, the LLBC build, scripts/kani-fmt.sh --check, and both clippy commands of the format-check workflow pass.
  • scripts/kani-regression.sh: every suite passes except script-based-pre/compiler_defaults (needs jq) and script-based-pre/cbmc_truncated_results (memory limit), which only fail in my container; the steps after the suites (codegen-firecracker.sh, the cargo-features-flag check, the -D warnings build) pass.
  • scripts/kani-llbc-regression.sh passes.
  • cargo deny --all-features --workspace check -s (the arguments of the Cargo Deny workflow) passes.

All of the above was run on nightly-2026-11-18.

Resolves #5189 (the automatic upgrade to nightly-2026-11-13 failed on the attribute API change from rust-lang/rust#165871, which this PR handles).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

- 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 <[email protected]>
@feliperodri
feliperodri requested review from a team as code owners November 17, 2026 19:33
@feliperodri feliperodri added the [C] Internal Tracks some internal work. I.e.: Users should not be affected. label Nov 17, 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 17, 2026
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 <[email protected]>
@feliperodri feliperodri changed the title Upgrade Rust toolchain to nightly-2026-11-17 Upgrade Rust toolchain to nightly-2026-11-18 Nov 18, 2026
@feliperodri
feliperodri requested a balanced review from Copilot November 18, 2026 16:12

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.

🟢 Approval recommended

No active review issues are reported for the toolchain upgrade and related compatibility changes.

No open issues 🎉

What changed in this PR

Updates Kani to nightly-2026-11-18, adapting its compiler integration and tests to Rust API changes and addressing the upgrade failure in #5189. Also removes chrono from developer profiling.

Changes:

  • Updates attribute handling, diagnostics, unsupported view-type handling, and generic float intrinsic models.
  • Adjusts SIMD test cloning, pattern-type feature gates, and argument checks for the new toolchain.
  • Replaces chrono timestamps with a standard-library UTC formatter and adds unit coverage.
File Description
tools/​scanner/​src/​bin/​scan.rs Avoids allocation when checking verbose arguments.
tests/​script-based-pre/​autoharness_pattern_type/​pattern_type_probe.rs Removes the obsolete pattern-type macro gate.
tests/​script-based-pre/​autoharness_niche/​niche_probe.rs Removes the obsolete gate while preserving line numbers.
tests/​kani/​Intrinsics/​MinNum/​minnumf64.rs Tests the generic f64 minimum intrinsic.
tests/​kani/​Intrinsics/​MinNum/​minnumf32.rs Tests the generic f32 minimum intrinsic.
tests/​kani/​Intrinsics/​MaxNum/​maxnumf64.rs Tests the generic f64 maximum intrinsic.
tests/​kani/​Intrinsics/​MaxNum/​maxnumf32.rs Tests the generic f32 maximum intrinsic.
tests/​kani/​Intrinsics/​CopySign/​copysignf64.rs Updates calls and comments for generic f64 copysign.
tests/​kani/​Intrinsics/​CopySign/​copysignf32.rs Updates calls and comments for generic f32 copysign.
tests/​expected/​valid-value-checks/​place_access_pattern.rs Removes the obsolete pattern-type macro gate.
tests/​expected/​valid-value-checks/​custom_niche.rs Removes the obsolete gate while preserving line numbers.
rust-toolchain.toml Pins nightly-2026-11-18.
library/​kani/​src/​models/​mod.rs Uses whole-value SIMD cloning and removes derived Debug.
kani-driver/​src/​session.rs Adds standard-library UTC profiling timestamps and tests.
kani-driver/​src/​concrete_playback/​playback.rs Avoids allocation when checking --nocapture.
kani-driver/​Cargo.toml Removes the chrono dependency.
kani-compiler/​src/​session.rs Supplies the new diagnostic no_graphics field.
kani-compiler/​src/​kani_middle/​transform/​loop_contracts.rs Avoids allocation in the loop-contract feature check.
kani-compiler/​src/​kani_middle/​transform/​contracts.rs Avoids allocation in the function-contract feature check.
kani-compiler/​src/​kani_middle/​attributes.rs Replaces removed rustc attribute APIs with helpers.
kani-compiler/​src/​intrinsics.rs Maps generic copysign, maximum, and minimum to existing models.
kani-compiler/​src/​codegen_cprover_gotoc/​overrides/​hooks.rs Avoids allocation in the loop-contract feature check.
kani-compiler/​src/​codegen_cprover_gotoc/​context/​current_fn.rs Uses the replacement attribute-value helper.
kani-compiler/​src/​codegen_cprover_gotoc/​codegen/​typ.rs Explicitly rejects unsupported view types.
kani-compiler/​src/​codegen_cprover_gotoc/​codegen/​statement.rs Avoids allocations in loop-contract feature checks.
kani-compiler/​src/​codegen_cprover_gotoc/​codegen/​function.rs Avoids allocation in the loop-contract feature check.
kani-compiler/​src/​codegen_cprover_gotoc/​codegen/​foreign_function.rs Avoids allocation in the C-FFI feature check.
Cargo.lock Removes chrono and dependencies no longer needed.

Review effort: Balanced

The toolchain's stdarch now links svld4_s32 to
llvm.aarch64.sve.ld4.sret.nxv4i32.p0 instead of
llvm.aarch64.sve.ld4.sret.nxv4i32, so the test's check for the old name
failed on aarch64 (macos-15 in CI). Accept both names.
…ordinary calls

nightly-2026-11-17 implements Ord::max and Ord::min on integers with the new
integer_max and integer_min intrinsics. Kani has no model for them and uses their
fallback bodies, but -Z uninit-checks reported every call as an unsupported
intrinsic, failing any harness that reaches them. The fallback body is ordinary MIR,
instrumented like any other function, so treat such a call as an ordinary call.
Intrinsics that Kani handles explicitly keep their handling.

Signed-off-by: Felipe R. Monteiro <[email protected]>
@feliperodri

Copy link
Copy Markdown
Member Author

compile-timer-short failure: diagnosis

TL;DR: the failure is mostly noise from the 5% threshold on very small crates. There is a real but small codegen slowdown, and it comes from the toolchain, not from Kani changes in this PR. I don't think it should block the PR.

What failed (old faffcee / nightly-2026-11-12 vs new d6cd5cb / nightly-2026-11-18): the suite total went up +3.1%. Three crates crossed the max(5%, 2×std_dev) threshold: misc/array_fold (+5.9%), vec/box_dyn (+5.5%) and vec/string (+5.8%). These are the three smallest crates (~105–175ms), so a 6–10ms slip is enough to fail.

Why the flagged crates are noise

  • Across the last ~27 compile-timer-short runs, non-toolchain PRs mostly land within ±2% total. Several unrelated PRs failed at about +3%, including one on the old toolchain that only touches contracts.rs. Those runs flagged the same small crates.
  • On this PR, the flagged crates differ from run to run: btreeset/insert_any on 4857cbd; vec/string and vec/vec on 7d48b2b; array_fold, box_dyn and string on d6cd5cb.
  • In a local interleaved A/B (3 rounds, pinned cores), those three crates showed no consistent change (box_dyn −0.9%, array_fold −3.6%).
  • The job always times old first and new second on a shared runner, so any drift in machine speed during the job lands on the new side.

What's real

  • Toolchain bumps consistently shift the suite total up: +2.9% / +5.4% / +3.0% for nightly-2026-11-11, and +2.0% / +2.0% / +3.1% here.
  • I timed btreeset/insert_any and insert_same locally, 6 interleaved builds per version, with KANI_LOG=kani_compiler=info:
old new
Kani goto codegen 170–177ms 181–189ms (+~11ms, +6–7%)
everything before codegen (rustc frontend/MIR, Kani's MIR passes, cargo) 544–564ms 526–542ms (−~20ms)
total build 713–742ms 707–731ms (≈ flat)
  • The goto output is the same size (3.74MB vs 3.75MB), so the extra codegen time doesn't come from generating more code. It most likely comes from the new nightly's rustc internals or from building Kani with the new rustc/LLVM. I haven't profiled it further.

Possible follow-ups (not in this PR): alternate the old/new run order in the job, and add an absolute floor (a few ms) to the regression check so tiny crates can't fail on millisecond jitter.

@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.

LGTM. Thanks!

@feliperodri
feliperodri added this pull request to the merge queue Nov 18, 2026
Merged via the queue into model-checking:main with commit 969f464 Nov 18, 2026
42 of 52 checks passed
@feliperodri
feliperodri deleted the toolchain-2026-11-17 branch November 18, 2026 20:36
Debasishhh pushed a commit to Debasishhh/kani that referenced this pull request Nov 19, 2026
**Depends on model-checking#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 model-checking#5188.

The automated Charon upgrade has failed since nightly-2026.10.27
(model-checking#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 `PolyTraitRef`s (`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 model-checking#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 model-checking#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 model-checking#5086

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Signed-off-by: Felipe R. Monteiro <[email protected]>
feliperodri added a commit to feliperodri/kani that referenced this pull request Nov 20, 2026
model-checking#5188 (the toolchain upgrade) is merged, and this branch is rebased on
`main`. The second commit addresses the review comments.

With `-Z uninit-checks`, any pointer to a trait object was reported as
unsupported, even where nothing uninitialized is involved, e.g.
`size_of_val` on a `&dyn Debug` (model-checking#5166). This blocks uninit checking on
verify-rust-std's Challenge 2 solution
(model-checking/verify-rust-std#649).

### Changes

- **Checks on a trait object pointee:** emit none. Nothing is read at
type `dyn Trait`: an unsized value cannot be loaded, copied or stored,
so a place `*ptr` of that type is only borrowed, re-pointed or used for
its metadata. The bytes behind it are read by the concrete type's code
that the vtable dispatches to, which is checked with the concrete
layout.
- **Marking a trait object pointee initialized:** skip it. This only
happens where a pointer to an existing value is created (from a
reference, or for a drop). Creating a pointer does not change which
bytes are initialized, so the tracked state stays as it was; at worst
bytes that were never tracked stay uninitialized, a false alarm rather
than a missed one. **Marking it uninitialized** cannot be skipped
soundly and is still reported as unsupported.
- **Unsizing a pointer to a sized value into `*const dyn Trait`:** mark
the value initialized with its concrete layout (new `SetAs` operation),
as for any raw pointer created from a reference, instead of reporting
"unsized pointers" as unsupported.
- **Vtables:** reading a trait object's metadata (`PtrMetadata`, which
`ptr::metadata` lowers to) marks its vtable header (size, alignment,
drop) initialized (new `SetVtable` operation). The vtable is constant
data emitted by the code generator, so its memory was never marked
initialized, and a check such as `can_dereference(vtable_ptr as *const
[usize; 3])` failed.
- `kani::mem::is_initialized` on a trait object pointer still reports
that it cannot be answered.

### Testing

- New `tests/expected/uninit/trait-objects`:
`size_of_val`/`align_of_val` on `&dyn` (the issue's reproducer), raw
`dyn` pointers and their metadata, `Box<dyn Trait>`, reading a vtable
header through `can_dereference` and a raw read, and reading a value
back through a `*const dyn` pointer all verify; reading a padding byte
through a pointer derived from a trait object is still reported.
- `tests/expected/uninit/dyn-pointee-write` (reborrowing a `*const dyn`)
now verifies.
- `scripts/kani-regression.sh` passes in the Kani CI image, apart from
`compiler_defaults` (needs `jq`) and `cbmc_truncated_results` (memory
limit), which only fail in my container.
- verify-rust-std#649: with this change backported to the Kani commit it
pins (`c5e65fd`), its 11 trait-object harnesses (`vtable_size`,
`vtable_align`, `size_of_val_dyn`, `align_of_val_dyn`, `align_of_val`
usage) pass with `-Z uninit-checks`. The remaining uninit failures there
come from unions nested in other types and raw pointers to unions
(model-checking#5151), handled in a follow-up PR.

Resolves model-checking#5166

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Signed-off-by: Felipe R. Monteiro <[email protected]>
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. 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.

Toolchain upgrade to nightly-2026-11-13 failed

3 participants