postprocess: Validate applied rewrites transactionally with cargo check - #1992
Open
Hellboy28D wants to merge 5 commits into
Open
postprocess: Validate applied rewrites transactionally with cargo check#1992Hellboy28D wants to merge 5 commits into
Hellboy28D wants to merge 5 commits into
Conversation
Contributor
|
The c2rust postprocessor is much less mature than the transpiler and refactorer. The stack containing #1997 should land next. It is a more fundamental change to make the postprocessor run at an acceptable clip. Once the above lands, feel free to rebase this PR and ping me for review. |
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.
Related to #1869
Currently, transformed Rust is written into the tree without verifying it
still compiles, so malformed model output (e.g. a dropped
}) breaks thebuild and is misattributed to the rewrite.
This adds transactional validation to
c2rust-postprocess:cargo check;any batch that breaks the build is rolled back, and the failing batch
is bisected to isolate the culprit rewrite.
so a pre-existing broken build is never blamed on the model (exits 1
with a clear error).
--validate-cmd CMDflag runs extra user-supplied shellcommands (e.g.
cargo build) aftercargo check; every command mustexit 0 for a rewrite to be accepted.
Complementary to the syn-based structural parity check discussed in
#1869 / #1876:
cargo checkcatches invalid Rust, while a parity checkwould also catch valid-but-modified code. Does not close #1869.
Tests cover the pass, rollback, and baseline-failure paths.