Upgrade Rust toolchain to nightly-2026-06-01 - #4760
Open
feliperodri wants to merge 1 commit into
Open
Conversation
feliperodri
force-pushed
the
toolchain-2026-06-01
branch
from
August 25, 2026 18:14
2ae175e to
8189db1
Compare
feliperodri
force-pushed
the
toolchain-2026-06-01
branch
2 times, most recently
from
August 25, 2026 19:17
08a421d to
fa20876
Compare
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.
feliperodri
force-pushed
the
toolchain-2026-06-01
branch
from
August 25, 2026 21:06
fa20876 to
110a309
Compare
feliperodri
enabled auto-merge
August 25, 2026 21:13
Member
Author
|
The next upgrade, |
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-05-01tonightly-2026-06-01. Four upstream changes drive most of this.1.
Retagmoved ontoRvalue::UseStatementKind::RetagandRetagKindare gone;Rvalue::Usenow carries aWithRetagflag 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 synthesizedUses passWithRetag::No.internal_mir'sRetagKindconversion becomes aWithRetagone.2.
Variants::Multiplestores aVariantLayout, not aLayoutDataThe new type carries only per-field offsets — no
FieldsShape(so no field order) and no alignment. Variant layouts now come fromLayout::for_variant, which is whatrustc_codegen_ssadoes and which restores the field order. A newvariant_layouthelper 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.That change bit back:
for_variantreports the enum's align for a variant (align: parent.align), which over-pads every variant and inflates the enum.check_vtable_sizecaught it as an ICE ontests/cargo-kani/iss2857(48 vs 55 bytes). Socodegen_struct_fields/codegen_alignment_paddingnow take the align explicitly, and a variant's own align is computed as the maximum of its fields' aligns — which is what the per-variantLayoutDataused to carry.3.
rustc_layout_scalar_valid_range_start/_endwere removedReplaced by pattern types, the same move
core::num::niche_typesmade. The tests that define ranged scalar newtypes are converted tostd::pat::pattern_type!.This narrows the layout-niche feature added in #4716: a pattern type is not an ADT and has no
Arbitraryimplementation, socan_derive_arbitrarycannot synthesize a struct that has one as a field, and locally-defined ranged types are now skipped rather than harnessed. The assumption still works end to end throughstd::time::Duration(the motivating case from the #3832 triage), andtests/script-based-pre/autoharness_nichepins both halves so the reduced reach is asserted by a test rather than silent. Tracked in #4758 with a concrete fix sketch.4. New
Rvalue::ReborrowUser-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.Assorted API changes
CodegenBackendmovedCrateInfofromcodegen_cratetojoin_codegencompiler_interface.rsrustc_data_structures::stable_hasherrenamed tostable_hash;HashStable/hash_stabletoStableHash/stable_hashreachability.rsnormalizecallback ofptr_metadata_ty{,_or_tail}now takesUnnormalizedtyp.rsFieldDef::tyandinstantiate*sites need.skip_normalization()typ.rs,intrinsics.rsTagEncoding::Niche'sniche_variantsis the langRangeInclusive(publicstart/lastfields, not methods)rvalue.rs,statement.rsuseless_borrows_in_formattingclippy lintTest change worth calling out
vtable_size_align_dropno longer asserts the exact identity of the vtable's drop pointer. Traced with Kani's debug logging: the drop-glue shim is nowcore::ptr::drop_glue::<T>rather thancore::ptr::drop_in_place::<T>, anddrop_glueis not nameable from source. It checks the slot is populated instead; the size and align fields the test is named for are unchanged. This weakens the test — it no longer checks the slot holds the drop glue for the right type — so it is tracked in #4759 with options for restoring that coverage.Both of these failures were confirmed to be genuine
nightly-2026-06-01regressions rather than pre-existing fragility, by rebuilding the parent commit againstnightly-2026-05-01, where both pass.drop_in_placenow takes a reference to reach the drop glueRelated to the same rename:
core::ptr::drop_in_placeused to be the drop lang item, with its body replaced wholesale by the compiler. It is now a wrapper that calls the newdrop_gluelang item through&mut *to_drop, and creating that reference asserts the pointee is aligned and valid — so dropping through a raw pointer carries a precondition it did not before.That surfaced in
expected/loop-contract/loop_assigns_for_vec.rs, whoseloop_modifieshavocs the word holdingv.len()while the invariant only constrainsi; the drop after the loop then sees an unconstrained length. Strengthening the invariant withv.len() == i * 3 + 3is rejected (Rust intrinsic assumption failed), so expressing what the drop needs looks like a loop-contracts limitation rather than something this PR can fix. The test is renamedloop_assigns_for_vec_fixme.rswith the analysis recorded in the file, tracked in #4761. Verified thatVec's internal layout is unchanged, so the test's hard-coded.add(2)offset forlenis still correct.Two contract tests that deliberately pin a total check count needed their numbers updated:
capture_load_checks_elided36 → 34 andcapture_load_user_deref_pass60 → 58 (two checks inread_answer's own body became unreachable). In both cases the assertion the test actually exists for still holds — no user-facingpointer_dereferencegroup came back in the first, and the pinned{closure#3}::{closure#0}.pointer_dereference.1 - Status: SUCCESSis still present in the second — so the counts were updated with a note in each test explaining that the total is plumbing-sensitive and what it still guards against.Testing
Local, macOS aarch64, CBMC 6.10.0 (
cbmc-6.9.0-214-g45436eea34), all re-run after rebasing onto currentmain(which now includes #4717, whose newRvalue::Useconstruction site also needed theWithRetagargument):kanicargo-kaniscript-based-prestd-checkscargo-uicoverageuicadicaltests, see belowexpectedprusti/smack/kani-docs/json-handler/cargo-coverage/firecrackerOther gates, all clean:
cargo build-devcargo build-dev -- --features cprover --features llbccargo clippy --workspace --testsandRUSTFLAGS="--cfg=kani_sysroot" cargo clippy --workspace./scripts/kani-fmt.sh --checkRUSTFLAGS="-D warnings" cargo build --no-default-features --features cprovercprover_bindings,kani-compiler,kani-driver,kani_metadata,kani --features concrete_playback,kani_macrosEnvironment caveat: this CBMC build has no
cadical, soui/solver-{attribute,option}/cadicalfail locally on output text only ("The specified solver, 'cadical', is not available"), andexpected/shadow/slices/slice_splitis very slow under the MiniSat fallback. Both are expected to be clean on CI.Towards #4758, #4759, #4761.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.