Upgrade Rust toolchain to nightly-2026-08-01 - #4767
Open
feliperodri wants to merge 5 commits into
Open
Conversation
A much smaller upgrade than the previous two: no verification behaviour changed, and no test needed adjusting. **`FieldDef` moved to the `crate_def_with_ty!` macro.** Its inherent `ty()` and `ty_with_args()` are now provided by the `CrateDefType` trait, so the 17 call sites just need that trait in scope. This is a pure import change -- the semantics are identical (both still resolve to `def_ty`/`def_ty_with_args`). **`EarlyBinder::bind` takes the interner.** `bind(value)` becomes `bind(tcx, value)` at five sites. **`Terminator` gained MIR-level attributes** (`attributes: ThinVec<AttributeKind>`). The stable representation has no equivalent, and Kani-synthesized terminators carry none, so `internal_mir` passes an empty vector. **`TerminatorKind::Drop` lost `async_fut`**, so that field is dropped from the `internal_mir` conversion. **Work products are an `UnordMap`, not an `FxIndexMap`**, in `CodegenBackend::join_codegen`'s return type (both backends). Full regression run is clean on the first attempt: kani 607/607, cargo-kani 71/71, expected, script-based-pre 68/68, std-checks, cargo-ui, coverage, prusti, smack, kani-docs, json-handler, cargo-coverage, all unit tests, both `-D warnings` clippy gates, the `-D warnings` build, fmt, and the LLBC build.
`cargo_build` hardcoded the compiler output directory as `target/kani/<triple>/debug/deps`, and `cargo_project` then canonicalized it -- so any layout that does not match becomes `error: No such file or directory (os error 2)`. That layout is cargo's to choose, and cargo 1.99 changes it: artifacts no longer share `debug/deps`, each package getting its own `debug/build/PKG/HASH/out/` instead. Artifact discovery was already layout-agnostic (`map_kani_artifact` derives every path from the `filenames` cargo reports), so the hardcoded directory was the only thing tying the driver to the old layout. Derive it from the discovered artifacts instead, and drop the canonicalization: an artifact path is canonical already, and the no-artifacts fallback names a directory cargo had no reason to create. Two tests hardcoded the same layout and are now layout-agnostic: `check-output` searches the target directory for its `--gen-c` output, and `cargo_playback_opts` asserts only the file name of the executable whose path cargo reports.
nightly-2026-08-01 is the first 1.99 nightly, and 91 compile errors came with it. `Statement`/`Terminator` carry a `SourceInfo`, not a bare `Span` (78 of the 91 errors). A new `synthetic_source_info(span)` helper in `transform/body.rs` documents the choice of the outermost source scope (scope 0, which `Body::new` always allocates) for MIR Kani synthesizes; reads become `.source_info.span`. `predicates_of` became `clauses_of`, returning `GenericClauses` (`parent` + `clauses`) instead of `GenericPredicates` (`parent` + `predicates`). Same shape and same `instantiate`, so this is a rename at the four call sites -- three in `codegen_units.rs` from model-checking#4706/model-checking#4718, one in the LLBC backend. `ty::FnDef`'s generic args are bound, so three `Instance::{try,expect}_resolve` call sites need `.skip_binder()`. `ValueAbi::ScalarPair` became a struct variant with a new `b_offset` field. Two new enum variants: `AssertMessage::NullReferenceConstructed`, handled like `NullPointerDereference` (same property class, description from rustc_public); and `InstanceKind::LlvmIntrinsic`, which codegens like any other item and has no Rust body for reachability to collect. That new variant is why `expected/issue-3571` needed updating. Constructing a null reference (`&*(0 as *const u32)`) used to report "null pointer dereference occurred"; rustc now distinguishes the two and reports "null reference produced". The UB is still caught and the harness still fails -- only the wording is more precise -- so the expectation follows rustc's message rather than pinning the old one. Also adapts to `LocalModDefId` being renamed `LocalModId` and `Region::new_early_param` moving to the `RegionExt` extension trait. Four tests needed adjusting because `std::intrinsics::{size_of,align_of}` are now comptime fns and cannot be called at runtime. The two `DynTrait` tests used `size_of` incidentally, to compare a vtable field against a type's size, so they use `std::mem::size_of`. The two `Intrinsics/ConstEval` tests exist to check the intrinsics themselves, so each call is bound to a `const` -- which is what that directory is about, and the only way now legal. cargo 1.99 also ships with this nightly and changed the layout under `target/`, which broke the whole cargo-based flow. That fix is not part of this commit: it stands on its own, applies to the current toolchain, and is under review separately.
feliperodri
marked this pull request as ready for review
August 27, 2026 19:51
feliperodri
enabled auto-merge
August 27, 2026 19:51
The merge from main brought in two new tcx.predicates_of(..).predicates call sites (from model-checking#4726's fn_bound_candidates) that were not adapted to the nightly-2026-08-01 rename. predicates_of became clauses_of (returning GenericClauses instead of GenericPredicates), so these fail to compile against the upgraded toolchain. Convert them the same way as the rest of this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Bumps
rust-toolchain.tomlfromnightly-2026-07-01tonightly-2026-08-01, the first 1.99 nightly. 91 compile errors came with it.1.
Statement/Terminatorcarry aSourceInfo, not a bareSpan(78 of the 91 errors)A new helper in
transform/body.rskeeps the choice of scope in one documented place rather than spreading a barescope: 0across ~78 sites:Reads become
.source_info.span.2.
predicates_ofbecameclauses_ofReturns
GenericClauses(parent+clauses) instead ofGenericPredicates(parent+predicates). Same shape and sameinstantiate, so this is a rename at four call sites — three incodegen_units.rsfrom #4706/#4718, one in the LLBC backend.3.
ty::FnDef's generic args are boundThree
Instance::{try,expect}_resolvecall sites need.skip_binder().4.
ValueAbi::ScalarPairbecame a struct variantWith a new
b_offsetfield.5. Two new enum variants
AssertMessage::NullReferenceConstructed— handled likeNullPointerDereference: same property class, description taken fromrustc_publicrather than hardcoded.InstanceKind::LlvmIntrinsic— codegens like any other item, and has no Rust body for reachability to collect.Plus
LocalModDefIdrenamed toLocalModId, andRegion::new_early_parammoving to theRegionExtextension trait.Test changes (5 files)
std::intrinsics::{size_of,align_of}are now comptime fns and cannot be called at runtime, which affected four tests:tests/kani/DynTrait/{nested_boxes,vtable_size_align_drop}.rsusedsize_ofincidentally, to compare a vtable field against a type's size — switched tostd::mem::size_of.tests/kani/Intrinsics/ConstEval/{size_of,align_of}.rsexist to check the intrinsics themselves, so each call is bound to aconst— which is what that directory is about, and the only way now legal.expected/issue-3571— a genuine behaviour change worth flagging. Constructing a null reference (&*(0 as *const u32)) used to reportnull pointer dereference occurred; rustc now distinguishes constructing a null reference from dereferencing a null pointer and reportsnull reference produced. rustc also emits a newmisaligned pointer to reference castcheck at the same site. The UB is still caught and the harness still fails — only the wording is more precise — so the expectation follows rustc's message rather than pinning the old one.No other test needed adjusting, and no verification behaviour changed.
Testing
Local, macOS aarch64, CBMC 6.10.0 (
cbmc-6.9.0-214-g45436eea34), on the stack rebased onto currentmain(which now includes #4760):kanicargo-kanicargo-uiexpecteduiAlso clean: both the CPROVER and LLBC builds,
cargo clippy --workspace --tests -- -D warnings,RUSTFLAGS="--cfg=kani_sysroot" cargo clippy --workspace -- -D warnings, and./scripts/kani-fmt.sh --check.The two
expectedfailures were run before the fix above and are accounted for:expected/issue-3571— the null-reference wording change; fixed in this PR, verified passing.expected/shadow/slices/slice_split— I interrupted this one to let the suite finish. It is not an 08-01 regression: I timed it on the 07-01 branch as a control and it is equally slow there (>20 min in CBMC's SAT solver on both), so it is a slow test on this machine rather than anything this upgrade introduced. CI covers it.The two
uifailures aresolver-attribute/cadicalandsolver-option/cadical, both expectingSolving with CaDiCaL. My local CBMC build reportsThe specified solver, 'cadical', is not available. The default solver will be used instead.— a missing solver in my environment, independent of the Rust toolchain.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.