Skip to content

Add checks for enums in scan-deadcode#4392

Open
Villosse wants to merge 4 commits into
Rust-GCC:masterfrom
Villosse:4367
Open

Add checks for enums in scan-deadcode#4392
Villosse wants to merge 4 commits into
Rust-GCC:masterfrom
Villosse:4367

Conversation

@Villosse

Copy link
Copy Markdown
Contributor

Fixes #4367

@Villosse

Copy link
Copy Markdown
Contributor Author

I still need to fix tests that does not pass testsuite (with new warning, it seems logic)

@dkm

dkm commented May 27, 2026

Copy link
Copy Markdown
Member

Hello,
What's the status of this PR? Do you need any help or anything to getting it ready?

@powerboat9 powerboat9 added the failing build CI One or more build CI actions aren't passing label Jun 8, 2026
Villosse added 2 commits June 11, 2026 16:32
Adds missing warnings for Enums.

Fixes: Rust-GCC#4367

gcc/rust/ChangeLog:

	* checks/lints/rust-lint-scan-deadcode.h: Add warnings for
	Enums.

Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
Adds simple test with unused Enum.

Addresses Rust-GCC#4367

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4367.rs: New test.

Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
@CohenArthur CohenArthur marked this pull request as ready for review June 11, 2026 14:40
@CohenArthur CohenArthur changed the title 4367 Add checks for enums in scan-deadcode Jun 11, 2026
@CohenArthur CohenArthur enabled auto-merge June 11, 2026 15:48
gcc/rust/ChangeLog:

	* checks/lints/rust-lint-scan-deadcode.h: Add more functions that
	are reused throught the visitor and make `should_warn` perform
	all checks.
Since we now check for unused enums, we have to tweak the testuite to reflect that.

gcc/testsuite/ChangeLog:

	* rust/compile/derive-debug1.rs: Add missing `pub` qualifier.
	* rust/compile/derive-hash1.rs: Likewise.
	* rust/compile/derive_clone_enum1.rs: Likewise.
	* rust/compile/derive_clone_enum2.rs: Likewise.
	* rust/compile/derive_clone_enum3.rs: Likewise.
	* rust/compile/enum_discriminant1.rs: Likewise.
	* rust/compile/for-loop1.rs: Likewise.
	* rust/compile/for-loop2.rs: Likewise.
	* rust/compile/glob_import_enum.rs: Likewise.
	* rust/compile/if_let_expr_simple.rs: Likewise.
	* rust/compile/issue-3382.rs: Likewise.
	* rust/compile/issue-3550.rs: Likewise.
	* rust/compile/issue-3597.rs: Likewise.
	* rust/compile/issue-3605.rs: Likewise.
	* rust/compile/issue-3651.rs: Likewise.
	* rust/compile/issue-3670.rs: Likewise.
	* rust/compile/issue-4367.rs: Likewise.
	* rust/compile/issue-850.rs: Likewise.
	* rust/compile/iterators1.rs: Likewise.
	* rust/compile/parse_associated_type_as_generic_arg.rs: Likewise.
	* rust/compile/parse_associated_type_as_generic_arg2.rs: Likewise.
	* rust/compile/parse_associated_type_as_generic_arg3.rs: Likewise.
	* rust/compile/torture/tuple_enum_variants.rs: Likewise.
	* rust/compile/torture/utf8_identifiers.rs: Likewise.
	* rust/compile/try-trait.rs: Likewise.
	* rust/compile/try_block1.rs: Likewise.
	* rust/compile/while_let1.rs: Likewise.
	* rust/execute/torture/enum_intrinsics2.rs: Likewise.
	* rust/execute/torture/for-loop1.rs: Likewise.
	* rust/execute/torture/for-loop2.rs: Likewise.
	* rust/execute/torture/iter1.rs: Likewise.
@CohenArthur CohenArthur disabled auto-merge June 11, 2026 16:36
@CohenArthur CohenArthur enabled auto-merge June 11, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

failing build CI One or more build CI actions aren't passing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enum unused not detected

4 participants