Skip to content

Conversation

@lucasly-ba
Copy link
Contributor

This is the prolongation of PR #4055, since it might be outdated.

@lucasly-ba lucasly-ba force-pushed the llb-unused-var-checker branch from 9adbb05 to 319e98d Compare November 12, 2025 16:02
@dkm
Copy link
Member

dkm commented Nov 13, 2025

gcc/rust/ChangeLog:

	* Make-lang.in: New file.

This is misleading. "New file" is idiomatic for "this is a new file". You probably meant "I've added new file rules in the makefile". Can you rephrase that and make it less confusing? Thanks!

Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@philberty philberty added this pull request to the merge queue Nov 13, 2025
@philberty philberty removed this pull request from the merge queue due to a manual request Nov 13, 2025
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish github could let you review git commit comments.

Yeah this needs a longer git commit comment describing how this works. Also @dkm is right dont use new file on that make file changelog just say updated or files added

@philberty philberty added the diagnostic diagnostic static analysis label Nov 13, 2025
@github-project-automation github-project-automation bot moved this to In progress in Project Pineapple Nov 13, 2025
This change moves the unused variable checker from the type resolver
to HIR. We can now use the HIR Default Visitor, and it will be much more
easier to implement other unused lints with this change.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new files rules in Makefile.
	* lang.opt: Add new flag.
	* rust-session-manager.cc (Session::compile_crate): Execute new variable checker.
	* checks/lints/unused-var/rust-unused-var-checker.cc (UnusedVarChecker): Implement unused
	variable checker.
	* checks/lints/unused-var/rust-unused-var-checker.h (UnusedVarChecker): Implement unused
	variable checker.
	* checks/lints/unused-var/rust-unused-var-collector.cc (UnusedVarCollector): Implement
	unused variable collector.
	* checks/lints/unused-var/rust-unused-var-collector.h (UnusedVarCollector): Implement
	unused variable collector.
	* checks/lints/unused-var/rust-unused-var-context.cc (UnusedVarContext): Implement
	unused variable context.
	* checks/lints/unused-var/rust-unused-var-context.h (UnusedVarContext): Implement unused
	variable context.

gcc/testsuite/ChangeLog:

	* rust/compile/static_item_0.rs: New test.
	* rust/compile/template_function_0.rs: New test.

Signed-off-by: Lucas Ly Ba <[email protected]>
@lucasly-ba lucasly-ba force-pushed the llb-unused-var-checker branch from 319e98d to c036373 Compare November 14, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostic diagnostic static analysis

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants