Repository navigation
Preserve unlabelled break targets in nested control-flow macros - #581
Merged
nunoplopes merged 1 commit intoNov 2, 2026
Merged
Conversation
Contributor
|
@perfloop-agent Instead of having this complicated test in control_flow.rs, extend the C test (goto_nested_loop_control.c) to have a version with switch to cover the new code. |
Signed-off-by: Perfloop Agent <agent@perfloop.ai> Signed-off-by: Tomás Senart <ts@perfloop.ai>
perfloop
Bot
force-pushed
the
perfloop-pr-open-0ypb55ds2b
branch
from
November 2, 2026 14:52
db14023 to
e870e35
Compare
Contributor
Author
|
I removed the added Rust tests and extended the C fixture with a switch version. It nests labelled compounds inside a fallthrough switch and checks that break leaves the switch while the user loop continues. |
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.
Unlabelled breaks inside nested control-flow macros now reach their intended targets rather than a generated loop. The rewriters inspect nested macro inputs before those inputs expand.
Real user loops still stop propagation, and explicitly labelled exits are unchanged. Traversal recognizes macros named
goto_block!andswitch!, including qualified paths; other macro token bodies remain opaque.Testing
tests/unit/goto_nested_loop_control.c checks nested labelled compounds in a user loop and in a fallthrough switch. The switch version checks that a break leaves the switch while later user-loop iterations still run. Lit compares native C with both translation models and checks their generated-source expectations.
The macro test runner reports 23 passed, no failures and no ignored tests, covering dispatch, fallthrough, goto jumps and the compile-fail harness. The existing Rust tests are unchanged.
Coverage is bounded; affected application prevalence remains unknown.
5 recorded checks pass with this change.
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart.