Fix loop label placement in WhileLoopExpr lowering#4522
Draft
Islam-Imad wants to merge 1 commit intoRust-GCC:masterfrom
Draft
Fix loop label placement in WhileLoopExpr lowering#4522Islam-Imad wants to merge 1 commit intoRust-GCC:masterfrom
Islam-Imad wants to merge 1 commit intoRust-GCC:masterfrom
Conversation
the loop label was placed early in the context and its should be added after the end of the loop. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Fix while label place. gcc/testsuite/ChangeLog: * rust/execute/while-label-break.rs: New test. Signed-off-by: Islam-Imad <islamimad404@gmail.com>
Contributor
Author
|
cc @powerboat9 |
powerboat9
reviewed
Apr 12, 2026
| res += i; | ||
| i += 1; | ||
| if res + i >= 99 { | ||
| break 'calculation; |
Collaborator
There was a problem hiding this comment.
Does continue 'calculation work?
Contributor
Author
There was a problem hiding this comment.
i don't think because the label now after the loop.
i will check it then ping u for review
Contributor
Author
There was a problem hiding this comment.
its impossible to create a single label for both continue and break. we have to create two labels one at the start and one at the end. right now i am hacking gcc/go to see how this problem is solved and yeah there is separation.
Contributor
Author
There was a problem hiding this comment.
this will require more work to be done since we need to modify [loop,while,continue,break] and a lot of testing also. once its ready i will make it open again.
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.
the loop label was placed early in the context and its should be added after the end of the loop.
closes #4521