Upgrade Rust toolchain to nightly-2026-02-06#4655
Merged
tautschnig merged 3 commits intoJul 23, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Kani to a newer nightly and adapts the StableMIR body retrieval path to handle Rust’s change in how ADT constructor MIR is provided, avoiding panics when constructors from external crates are used as function values.
Changes:
- Bump Rust toolchain to
nightly-2026-02-06. - Add a targeted fallback that reconstructs constructor bodies via internal rustc APIs when
rustc_public::Instance::body()returnsNone.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rust-toolchain.toml | Updates the pinned nightly toolchain to nightly-2026-02-06. |
| kani-compiler/src/kani_middle/transform/mod.rs | Reconstructs missing StableMIR bodies for ADT constructors when Instance::body() is unavailable, preventing .unwrap() panics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rust-lang/rust stopped encoding *optimized* MIR for ADT constructors (`instance_mir` uses `mir_for_ctfe` for them). As a result, `rustc_public::Instance::body()` returns `None` for constructors imported from other crates (its `has_body` check keys off `is_mir_available`, i.e. optimized MIR), so codegenning a constructor used as a function value (e.g. `.map(Some)`) panicked on `instance.body().unwrap()`. Reconstruct the missing constructor body the same way `rustc_public`'s `BodyBuilder` would (fetch `instance_mir`, monomorphize, convert to stable MIR) when `body()` is `None` and the instance is a constructor; any other bodyless instance still panics. A regression test is added under `tests/kani/FunctionCall/ctor_as_fn_value.rs`, exercising cross-crate constructors (`Some`, `std::num::Wrapping`) and a local constructor used as function values; the cross-crate harnesses panic the compiler without this fix. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
tautschnig
force-pushed
the
toolchain-2026-02-06-manual
branch
from
July 18, 2026 23:48
5a1dc92 to
d90e863
Compare
feliperodri
approved these changes
Jul 21, 2026
feliperodri
left a comment
Contributor
There was a problem hiding this comment.
Tried to re-run the failed job but got:
Run actions/checkout@v6
Error: Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 21, 2026
tautschnig
enabled auto-merge
July 23, 2026 18:11
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.
rust-lang/rust stopped encoding optimized MIR for ADT constructors (
instance_mirusesmir_for_ctfefor them). As a result,rustc_public::Instance::body()returnsNonefor constructors imported from other crates (itshas_bodycheck keys offis_mir_available, i.e. optimized MIR), so codegenning a constructor used as a function value (e.g..map(Some)) panicked oninstance.body().unwrap().Reconstruct the missing constructor body the same way
rustc_public'sBodyBuilderwould (fetchinstance_mir, monomorphize, convert to stable MIR) whenbody()isNoneand the instance is a constructor; any other bodyless instance still panics.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.