gccrs: add break with label and loop lint - #4640
Merged
Merged
Conversation
lucasly-ba
force-pushed
the
break-with-label-and-loop
branch
3 times, most recently
from
July 6, 2026 12:02
7ea2f1b to
10fefb6
Compare
lucasly-ba
force-pushed
the
break-with-label-and-loop
branch
3 times, most recently
from
July 9, 2026 13:35
72f6354 to
19e9288
Compare
Contributor
Author
Member
|
merge conflicts |
Warn on a labeled `break` whose value is a loop expression, as it is easy to confuse with an unlabeled `break` of a labeled value. gcc/rust/ChangeLog: * checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit): New. * checks/lints/unused/rust-unused-checker.h (UnusedChecker::visit): New. * rust-lang.cc (grs_langhook_init_options_struct): Enable warn_unused. gcc/testsuite/ChangeLog: * rust/compile/break-with-label-and-loop_0.rs: New test. Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
lucasly-ba
force-pushed
the
break-with-label-and-loop
branch
from
August 15, 2026 21:28
19e9288 to
98dc027
Compare
Contributor
Author
|
should be good @philberty |
philberty
enabled auto-merge
August 15, 2026 21:47
philberty
disabled auto-merge
August 15, 2026 21:47
philberty
enabled auto-merge
August 15, 2026 21:47
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.
This patch adds the break with label and loop lint, which warns on a labeled
breakwhose value is a loop expression, as it is easy to confuse with an unlabeledbreakof a labeled value.Note: this branch is based on #4638 (fix ICE on break with a label and a value); the first commit is that fix, without which the construct cannot be compiled. It can be rebased once #4638 lands.
gcc/testsuite/ChangeLog: