Skip to content

gccrs: add unused comparisons lint#4626

Open
lucasly-ba wants to merge 1 commit into
Rust-GCC:masterfrom
lucasly-ba:unused-comparisons
Open

gccrs: add unused comparisons lint#4626
lucasly-ba wants to merge 1 commit into
Rust-GCC:masterfrom
lucasly-ba:unused-comparisons

Conversation

@lucasly-ba

Copy link
Copy Markdown
Contributor

This patch adds the unused comparisons lint, which warns on comparisons that are always true or false due to the type limits of an unsigned integer.

gcc/testsuite/ChangeLog:

* rust/compile/unused-comparisons_0.rs: New test.

@lucasly-ba lucasly-ba force-pushed the unused-comparisons branch 3 times, most recently from a0a3d0f to b8def32 Compare July 6, 2026 12:03
@lucasly-ba lucasly-ba force-pushed the unused-comparisons branch 2 times, most recently from 97217e2 to b707bc6 Compare July 8, 2026 22:30
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_type_limits.

gcc/testsuite/ChangeLog:

	* rust/compile/unused-comparisons_0.rs: New test.

Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
@lucasly-ba lucasly-ba force-pushed the unused-comparisons branch from b707bc6 to b4c3d57 Compare July 9, 2026 13:35
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