Skip to content

Upgrade Rust toolchain to nightly-2026-07-01 - #4764

Merged
feliperodri merged 3 commits into
model-checking:mainfrom
feliperodri:toolchain-2026-07-01
Aug 27, 2026
Merged

Upgrade Rust toolchain to nightly-2026-07-01#4764
feliperodri merged 3 commits into
model-checking:mainfrom
feliperodri:toolchain-2026-07-01

Conversation

@feliperodri

@feliperodri feliperodri commented Aug 25, 2026

Copy link
Copy Markdown
Member

Description

Bumps rust-toolchain.toml from nightly-2026-06-01 to nightly-2026-07-01.

A much smaller upgrade than the previous two (25 compile errors vs. 66 for 06-01): no verification behaviour changed and no test needed adjusting. Every change is a mechanical adaptation to a moved or renamed API.

1. FieldDef moved to the crate_def_with_ty! macro

// nightly-2026-06-01
pub struct FieldDef { pub(crate) def: DefId, pub name: Symbol }
impl FieldDef {
    pub fn ty_with_args(&self, args: &GenericArgs) -> Ty { .. }
    pub fn ty(&self) -> Ty { .. }
}

// nightly-2026-07-01
crate_def_with_ty! { pub FieldDef { pub name: Symbol } }

ty() and ty_with_args() are no longer inherent methods; they come from the CrateDefType trait, which the macro implements. The 17 call sites across 10 files therefore only need that trait in scope. The semantics are identical — both the old inherent methods and the trait defaults resolve to def_ty/def_ty_with_args — so this is a pure import change.

Imports were added per file to match each file's existing use rustc_public::.. style. Worth noting for future upgrades: as more rustc_public types migrate onto these macros, this particular adaptation is likely to recur, so a shared import point may eventually be worth it.

2. EarlyBinder::bind takes the interner

EarlyBinder::bind(value) becomes EarlyBinder::bind(tcx, value) — five sites in stubbing/mod.rs, transform/mod.rs and codegen/typ.rs.

3. Terminator gained MIR-level attributes

pub struct Terminator<'tcx> {
    pub source_info: SourceInfo,
    pub kind: TerminatorKind<'tcx>,
    pub attributes: ThinVec<AttributeKind>,   // new
}

The stable (rustc_public) representation has no equivalent, and terminators Kani synthesizes carry none, so the internal_mir conversion passes an empty vector.

4. TerminatorKind::Drop lost async_fut

That field is dropped from the internal_mir conversion.

5. Work products are an UnordMap

CodegenBackend::join_codegen's return type changed from FxIndexMap<WorkProductId, WorkProduct> to UnordMap<..>. Updated in both backends, including the downcast target and the empty map each returns.

Testing

Local, macOS aarch64, CBMC 6.10.0 (cbmc-6.9.0-214-g45436eea34). Clean on the first attempt — no test changes were needed:

Suite Result
kani 607 passed, 0 failed, 23 ignored
cargo-kani 71 passed, 0 failed
script-based-pre 68 passed, 0 failed, 1 ignored
std-checks 5 passed, 0 failed
cargo-ui 30 passed, 0 failed
coverage 20 passed, 0 failed
prusti / smack / kani-docs / json-handler / cargo-coverage / firecracker 8 / 40 / 13 / 5 / 2 / 0 passed, 0 failed
ui 151 passed, 2 failed — both the cadical tests, see below

Other gates, all clean:

  • cargo build-dev
  • cargo build-dev -- --features cprover --features llbc
  • cargo clippy --workspace --tests -- -D warnings and RUSTFLAGS="--cfg=kani_sysroot" cargo clippy --workspace -- -D warnings
  • RUSTFLAGS="-D warnings" cargo build --no-default-features --features cprover
  • ./scripts/kani-fmt.sh --check
  • Unit tests: cprover_bindings, kani-compiler, kani-driver, kani_metadata, kani --features concrete_playback, kani_macros

Environment caveat: this CBMC build has no cadical, so ui/solver-{attribute,option}/cadical fail locally on output text only ("The specified solver, 'cadical', is not available"). Both are expected to be clean on CI.

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

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.
@feliperodri
feliperodri force-pushed the toolchain-2026-07-01 branch from 9ac6b88 to 46f2e3b Compare August 27, 2026 00:02
@feliperodri
feliperodri marked this pull request as ready for review August 27, 2026 00:17
@feliperodri
feliperodri requested review from a team as code owners August 27, 2026 00:17
@feliperodri
feliperodri enabled auto-merge August 27, 2026 00:56
`EarlyBinder::bind` takes the interner as of nightly-2026-07-01. The
Fn-bounded generic instantiation added by model-checking#4726 landed on main after this
branch was written, so its two `bind` call sites still used the old
one-argument form and failed to compile against the new toolchain.
@feliperodri
feliperodri added this pull request to the merge queue Aug 27, 2026
Merged via the queue into model-checking:main with commit 29ca8fc Aug 27, 2026
33 of 34 checks passed
@feliperodri
feliperodri deleted the toolchain-2026-07-01 branch August 27, 2026 18:37
feliperodri added a commit to feliperodri/kani that referenced this pull request Aug 27, 2026
…del-checking#4766)

## Description

`cargo_build` hardcoded the compiler output directory as
`target/kani/<triple>/debug/deps`, and `cargo_project` then
canonicalized it. That layout is cargo's to choose, and **cargo 1.99
changes it**: artifacts no longer share `debug/deps` — each package gets
its own `debug/build/PKG/HASH/out/` — so `debug/deps` is never created
and the canonicalize fails:

```
error: No such file or directory (os error 2)
```

Artifact *discovery* was already layout-agnostic: `map_kani_artifact`
derives every path from the `filenames` that cargo reports. The
hardcoded directory was the only thing tying the driver to the old
layout.

This PR:

- Derives `CargoOutputs::outdir` from the discovered artifacts instead
of assuming a path.
- Drops the `canonicalize` in `cargo_project`. An artifact path is
canonical already (`Artifact::try_new` canonicalizes), and the
no-artifacts fallback names a directory cargo had no reason to create —
canonicalizing it turns a benign case into a hard error.
- Makes two tests 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 itself reports.

Note that with cargo 1.99 a multi-package build no longer has a single
output directory. `outdir` names one of them; it feeds only the
`output_dir` field of the `-Z unstable-options` JSON frontend, and
previously named a directory that under 1.99 does not exist at all. The
doc comment says so explicitly.

The layout change, confirmed locally on nightly-2026-08-01 (cargo
1.99.0-nightly):

```
# cargo 1.97
target/kani/<triple>/debug/deps/<pkg>-<hash>.kani-metadata.json

# cargo 1.99 -- one directory per package, no debug/deps at all
target/kani/<triple>/debug/build/<pkg>/<hash>/out/<pkg>-<hash>.kani-metadata.json
```

## Why this is a standalone PR

This unblocks the toolchain upgrade chain. It has no dependency on any
toolchain bump and is behaviour-preserving on the current toolchain, so
it can land on its own. The intended order is model-checking#4760 (2026-06-01) → model-checking#4764
(2026-07-01) → this PR → the 2026-08-01 bump, which is blocked on it.

## Testing

**On the current toolchain (nightly-2026-05-01, cargo 1.97 — old
layout):**

- `cargo-kani`: 71 passed, 0 failed
- `script-based-pre`: 70 passed, 2 failed — both failures
(`cargo_autoharness_filter`, `cargo_autoharness_slices`) reproduce on
unmodified `main` and are unrelated to this change
- `cargo test -p kani-driver`: 93 passed
- `./scripts/kani-fmt.sh --check`, `cargo clippy --workspace --tests --
-D warnings`, `RUSTFLAGS="--cfg=kani_sysroot" cargo clippy --workspace
-- -D warnings`: clean

**Cherry-picked onto the local 2026-08-01 branch (cargo 1.99 — new
layout), which is where the bug bites:**

| Suite | Before | After |
|---|---|---|
| `cargo-kani` | 68 failed | **71 passed, 0 failed** |
| `script-based-pre` | 11 failed | **68 passed, 0 failed** |

- Was this change tested? **Yes**
- Is this a breaking change? **No**

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants