fix: propagate verification errors and add PassManager integrity test#1066
Open
giwaov wants to merge 2 commits into0xMiden:nextfrom
Open
fix: propagate verification errors and add PassManager integrity test#1066giwaov wants to merge 2 commits into0xMiden:nextfrom
giwaov wants to merge 2 commits into0xMiden:nextfrom
Conversation
Fix a bug where verification errors after a pass were silently dropped because map_err on Ok(()) is a no-op. Change to directly set the result to Err(verification_result) so verification failures are properly propagated. Add a test that creates a BinaryOp, runs a pass that clears its operands (breaking the 2-operand invariant), and asserts the PassManager detects the broken invariant when verification is enabled. Closes 0xMiden#605
bitwalker
approved these changes
Apr 8, 2026
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.
Summary
Fix a bug in
OpToOpPassAdaptor::run()where verification errors weresilently dropped after a pass completed successfully. The original code
used
result.map_err(|_| verification_result)which is a no-op whenresultisOk(()), meaning verification failures were never propagatedto the caller.
The fix changes this to
result = Err(verification_result)so thatverification errors are always reported.
Test
Add a test (
pass_manager_detects_broken_invariant) that:test::Addoperation (a BinaryOp requiring 2 operands)CorruptBinaryOppass that clears the operands of the first BinaryOp it findsWithout the bug fix, this test would pass silently (the verification error would be dropped).
Closes #605