Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change that disables MIR inlining when stubbing is enabled.
No open issues 🎉
What changed in this PR
Prevents MIR inlining from bypassing Kani function stubs at optimization levels 2 and 3, addressing the false verification results reported in #5094.
Changes:
- Passes
-Z inline-mir=nowhen stubbing is enabled, including through function contracts. - Adds an optimization-level-2 regression test checking that a stub applies through an intermediate caller.
| File | Description |
|---|---|
tests/kani/Stubbing/stub_inlined_function.rs |
Tests stub application through a caller with optimization enabled. |
kani-driver/src/call_single_file.rs |
Disables MIR inlining when stubbing is enabled. |
Review effort: Balanced
Dependencies skip codegen, so passing the flag to them only changed their flags and forced a rebuild, which broke `build-cache-dirty` for `-Z function-contracts`. Add a cargo test for the local-crate path.
This branch has not been deployed
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.
At opt-level 2/3, rustc's MIR inliner copies a stubbed function into its callers, and
FnStubPassonly replaces the function's own body, so the stub was silently skipped there. This passes-Z inline-mir=noto the crate under verification whenever stubbing is enabled (including via function contracts). Dependencies skip codegen, so they don't get it; passing it to them would only force a rebuild.Adds
tests/kani/Stubbing/stub_inlined_function.rsandtests/cargo-kani/stubbing-inlined-function, which fail before this change.Resolves #5094
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.