Skip to content

gccrs: add ellipsis inclusive range patterns lint - #4633

Open
lucasly-ba wants to merge 1 commit into
Rust-GCC:masterfrom
lucasly-ba:ellipsis-inclusive-range-patterns
Open

lucasly-ba wants to merge 1 commit into
Rust-GCC:masterfrom
lucasly-ba:ellipsis-inclusive-range-patterns

Conversation

@lucasly-ba

Copy link
Copy Markdown
Contributor

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:

* rust/compile/ellipsis-inclusive-range-patterns_0.rs: New test.

@lucasly-ba
lucasly-ba force-pushed the ellipsis-inclusive-range-patterns branch 3 times, most recently from 2a4418f to f0ff778 Compare July 6, 2026 12:02
@lucasly-ba
lucasly-ba force-pushed the ellipsis-inclusive-range-patterns branch 2 times, most recently from f44238a to 8d8cabc Compare July 8, 2026 22:30
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
lucasly-ba force-pushed the ellipsis-inclusive-range-patterns branch from 8d8cabc to 4a2f4ea Compare July 9, 2026 13:45
@lucasly-ba

Copy link
Copy Markdown
Contributor Author

@P-E-P

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant