gccrs: add ellipsis inclusive range patterns lint - #4633
Open
lucasly-ba wants to merge 1 commit into
Open
lucasly-ba wants to merge 1 commit into
lucasly-ba wants to merge 1 commit into
Conversation
lucasly-ba
force-pushed
the
ellipsis-inclusive-range-patterns
branch
3 times, most recently
from
July 6, 2026 12:02
2a4418f to
f0ff778
Compare
lucasly-ba
force-pushed
the
ellipsis-inclusive-range-patterns
branch
2 times, most recently
from
July 8, 2026 22:30
f44238a to
8d8cabc
Compare
Lower the ellipsis syntax flag onto the HIR range pattern so that the deprecated `...` form can be distinguished from `..=`, then warn on it in the unused checker. gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Propagate the ellipsis syntax flag onto the lowered range pattern. * checks/lints/unused/rust-unused-checker.cc (UnusedChecker::visit): New. * checks/lints/unused/rust-unused-checker.h (UnusedChecker::visit): New. gcc/testsuite/ChangeLog: * rust/compile/ellipsis-inclusive-range-patterns_0.rs: New test. Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
lucasly-ba
force-pushed
the
ellipsis-inclusive-range-patterns
branch
from
July 9, 2026 13:45
8d8cabc to
4a2f4ea
Compare
Contributor
Author
This branch has not been deployed
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 ellipsis inclusive range patterns lint, which warns on the deprecated
...range pattern syntax and suggests using..=instead.It also propagates the ellipsis syntax flag when lowering range patterns to HIR, so the deprecated
...form can be distinguished from..=.gcc/testsuite/ChangeLog: