Repository navigation
Upgrade Rust toolchain to nightly-2026-11-18 - #5188
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 <[email protected]>
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]>
Signed-off-by: Felipe R. Monteiro <[email protected]>
There was a problem hiding this comment.
🟢 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
chronotimestamps 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]>
|
| 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.
969f464
**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]>
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]>
Upgrades the toolchain from
nightly-2026-11-12tonightly-2026-11-18. All the changes below came withnightly-2026-11-17;nightly-2026-11-18needed none.Changes for the new toolchain
Attribute::path_matchesandAttribute::value_str.attributes.rsnow checks a tool attribute's path itself (attr_path_matches, the same test rustc used to do) and reads apath = "value"attribute's string throughvalue_lit(attr_value_str).HumanReadableErrorTypegained ano_graphicsfield.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 intyp.rs, as it does forUnsafeBinder.copysign,maximum_number_nszandminimum_number_nszare now generic over the float type, asceil,sqrtand others became before. They joinGENERIC_FLOAT_INTRINSICS, so Kani keeps its own f32/f64 models; the six tests call the generic intrinsics.#[repr(simd)]types (MCP#838). The derivedClone/Debugof theCustomMasktest model inlibrary/kaniprojected 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.pattern_type_macrowas removed;pattern_type!is gated bypattern_types. Four tests drop the old gate (a comment keeps the line numbers their expected output refers to)..contains(&"...".to_string())calls flagged by the newunnecessary_to_ownedfinding use.iter().any(..).Removing
chronoRUSTSEC-2026-0543 (issued 2026-11-17) marks
chronoas unmaintained, with no fixed version, socargo denyfails on every PR and onmain.kani-driveronly used it to stamp the flamegraph file name in developer mode; that timestamp is now built fromstd::time::SystemTime(in UTC), with a unit test. This removeschronoand its time-zone crates fromCargo.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 exceptscript-based-pre/compiler_defaults(needsjq) andscript-based-pre/cbmc_truncated_results(memory limit), which only fail in my container; the steps after the suites (codegen-firecracker.sh, thecargo-features-flagcheck, the-D warningsbuild) pass.scripts/kani-llbc-regression.shpasses.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-13failed 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.