Skip to content

Keep a contract's harnesses in kani list when the harness is declared first - #5106

Open
Tianshu-Huang wants to merge 1 commit into
model-checking:mainfrom
Tianshu-Huang:fix-list-contract-harness-order
Open

Tianshu-Huang wants to merge 1 commit into
model-checking:mainfrom
Tianshu-Huang:fix-list-contract-harness-order

Conversation

@Tianshu-Huang

Copy link
Copy Markdown
Contributor

kani list shows a contracted function with no harnesses when its proof_for_contract harness comes before it in the source, for example a mod proofs; at the top of the file. The harness creates the function's entry first, and the function then overwrites it with an empty one.

Both branches now use entry(), so nothing is overwritten. When a harness creates the entry it stores the target's name rather than its own; the autoharness lookup below matches on that name and would panic on the old value once entries stop being replaced.

New test with one harness before the function and one after; it fails on main and passes here. The other list tests and kani autoharness --list on the same crate pass.

Resolves #5099.

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

@Tianshu-Huang
Tianshu-Huang requested review from a team as code owners November 2, 2026 09:19
@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 2, 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.

kani list reports no harnesses for a contract when the harness module is declared before the function

1 participant