Skip to content

Report explicit tail calls as unsupported instead of panicking - #5152

Open
mvanhorn wants to merge 1 commit into
model-checking:mainfrom
mvanhorn:fix/5131-explicit-tail-call-unsupported
Open

mvanhorn wants to merge 1 commit into
model-checking:mainfrom
mvanhorn:fix/5131-explicit-tail-call-unsupported

Conversation

@mvanhorn

Copy link
Copy Markdown

Why

Verifying code that uses an explicit tail call (become) can crash the compiler with a “not implemented” panic instead of reporting an unsupported feature.

rustc_public has no TailCall terminator variant, so converting a body containing one reaches unimplemented!(). Kani loaded these bodies without checking for explicit tail calls first.

What changed

The diff checks internal MIR before body conversion during transformation, proof metadata generation, and autoharness processing, including instantiation search. It reports each explicit tail call in the body at its source span and aborts with an unsupported-feature diagnostic. It adds a diagnostic regression test and a verification case where the harness never calls the function containing become. It also documents explicit tail calls as unsupported.

Testing

Ran cargo test locally for the kani resolve_deferred_fn_slots change; it passed. repo_lint was run with no output shown; the transcript does not record its exit status. ./scripts/ci/run-copyright-check.sh was run with no output shown; the transcript does not record its exit status. ./scripts/run-clang-format.sh -d was run with no output shown; the transcript does not record its exit status. ./scripts/run-autopep8.sh was run with no output shown; the transcript does not record its exit status.

(cargo clippy --all --message-format=json 2>/dev/null | jq 'select(.message!=null) | .message.code.code' | grep -v '^null$' | sort | uniq -c) || true produced no recorded output, but the pipeline does not establish that Clippy passed. The tests in tests/kani/TailCall/unreachable.rs, tests/ui/explicit-tail-calls/expected and tests/ui/explicit-tail-calls/main.rs fail without the fix in the kani resolve_deferred_fn_slots change (checked by reverting the source changes). Regression check for the kani resolve_deferred_fn_slots change: 1 fails on main, 1 passes with the fix; hosted CI not run.

The new test tests/kani/TailCall/unreachable.rs did not run here: no test runner for it was available. The new test tests/ui/explicit-tail-calls/main.rs did not run here: no test runner for it was available.

Fixes #5131

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

AI was used for assistance.

The diff checks internal MIR before body conversion during
transformation, proof metadata generation, and autoharness processing,
including instantiation search. It reports each explicit tail call in
the body at its source span and aborts with an unsupported-feature
diagnostic. It adds a diagnostic regression test and a verification case
where the harness never calls the function containing `become`. It also
documents explicit tail calls as unsupported.

Fixes model-checking#5131
@mvanhorn
mvanhorn requested review from a team as code owners November 11, 2026 09:04
@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 Nov 11, 2026

This branch has not been deployed

No deployments
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.

Compiler panic on explicit tail calls (become)

1 participant