Skip to content

postprocess: Validate full function structure before applying model output #1869

Description

@Crocodoctopus

c2rust-postprocess currently verifies only that comments were transferred correctly. It does not verify that the model preserved the rest of the function structure.

This lets malformed rewrites slip through. For example, if a model output drops a closing } from a function body, that invalid Rust can still be written into the tree. The result is two failures:

  1. The updated source no longer builds.
  2. A later merge_rust invocation can fail because it parses the root Rust file up front and expects valid Rust syntax.

Failure has been observed by running c2rust-postprocess on json-c-transpile/src/linkhash.rs with gemini-3.1-flash-lite. Smarter models don't appear to exhibit this behavior, probably still worth fixing.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions