Skip to content

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

Draft
feliperodri wants to merge 2 commits into
model-checking:mainfrom
feliperodri:toolchain-2026-07-01
Draft

Upgrade Rust toolchain to nightly-2026-07-01#4764
feliperodri wants to merge 2 commits into
model-checking:mainfrom
feliperodri:toolchain-2026-07-01

Conversation

@feliperodri

Copy link
Copy Markdown
Member

Important

Draft: do not review until #4760 (nightly-2026-06-01) is merged.

This branch is stacked on #4760, so its diff currently contains that commit too. Once #4760 lands this rebases down to the single nightly-2026-07-01 commit. Review only the last commit.

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.

Four upstream changes drive most of this.

**Retag moved onto `Rvalue::Use`.** `StatementKind::Retag` and `RetagKind` are
gone; `Rvalue::Use` now carries a `WithRetag` flag instead. Kani never modelled
retags (they are Stacked-Borrows/Miri only), so the statement arms are dropped,
the flag is ignored when reading a `Use`, and synthesized `Use`s pass
`WithRetag::No`. `internal_mir`'s `RetagKind` conversion becomes a `WithRetag`
one.

**`Variants::Multiple` stores a `VariantLayout`, not a `LayoutData`.** The new
type carries only per-field offsets -- no `FieldsShape` (so no field order) and
no alignment. Variant layouts now come from `Layout::for_variant`, which is what
`rustc_codegen_ssa` does and restores the field order; a new `variant_layout`
helper is used by both the type side (`codegen_enum_cases`) and the value side
(`codegen_aggregate`) so the goto struct's components and the operands
initializing them cannot disagree.

`for_variant` reports the *enum's* align for a variant (`align: parent.align`),
which would over-pad every variant and inflate the enum -- caught by
`check_vtable_size` on `tests/cargo-kani/iss2857` (48 vs 55 bytes). So
`codegen_struct_fields`/`codegen_alignment_padding` now take the align
explicitly, and a variant's own align is computed as the maximum of its fields'
aligns, which is what the per-variant `LayoutData` used to carry.

**`rustc_layout_scalar_valid_range_start`/`_end` were removed** in favour of
pattern types, the same move `core::num::niche_types` made. The tests that
define ranged scalar newtypes are converted to `std::pat::pattern_type!`. Note
the consequence for autoharness: a pattern type is not an ADT and has no
`Arbitrary` implementation, so `can_derive_arbitrary` cannot synthesize a struct
that has one as a field, and locally-defined ranged types are now skipped rather
than harnessed. The niche assumption added in model-checking#4716 is still exercised end to end
through `std::time::Duration`; `tests/script-based-pre/autoharness_niche` pins
both halves so the reduced reach is asserted rather than silent.

**New `Rvalue::Reborrow`** (user-definable reborrowing of ADTs via
`CoerceShared`). It is documented as a bitwise copy today, but the same docs
anticipate it changing memory layout, so codegen reports it as an unsupported
construct rather than silently modelling it as a copy. The points-to analysis
treats it as pointing wherever its place does.

Also adapts to: the `CodegenBackend` trait moving `CrateInfo` from
`codegen_crate` to `join_codegen` (both backends), `rustc_data_structures::
stable_hasher` being renamed to `stable_hash` with `HashStable`/`hash_stable`
becoming `StableHash`/`stable_hash`, the `normalize` callback of
`ptr_metadata_ty{,_or_tail}` now taking `Unnormalized`, more `FieldDef::ty` and
`instantiate*` sites needing `.skip_normalization()`, `TagEncoding::Niche`'s
`niche_variants` becoming the lang `RangeInclusive` (public `start`/`last`
fields), and the new `useless_borrows_in_formatting` clippy lint.

The `vtable_size_align_drop` test no longer asserts the exact identity of the
vtable's drop pointer: the drop-glue shim is now `core::ptr::drop_glue::<T>`
rather than `core::ptr::drop_in_place::<T>`, and `drop_glue` is not nameable
from source. It checks the slot is populated instead; the size and align fields
that the test is named for are unchanged.
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.
@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 Aug 25, 2026
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.

1 participant