Skip to content

gccrs: add type alias bounds lint - #4639

Open
lucasly-ba wants to merge 1 commit into
Rust-GCC:masterfrom
lucasly-ba:type-alias-bounds
Open

gccrs: add type alias bounds lint#4639
lucasly-ba wants to merge 1 commit into
Rust-GCC:masterfrom
lucasly-ba:type-alias-bounds

Conversation

@lucasly-ba

Copy link
Copy Markdown
Contributor

This patch adds the type alias bounds lint, which warns on bounds applied to the generic parameters of a type alias, since those bounds are not enforced.

Note: this branch is based on #4637 (fix ICE on generic type aliases); the first commit is that fix, without which the construct cannot be compiled. It can be rebased once #4637 lands.

gcc/testsuite/ChangeLog:

* rust/compile/type-alias-bounds_0.rs: New test.

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM but there are merge conflicts

@lucasly-ba
lucasly-ba force-pushed the type-alias-bounds branch 2 times, most recently from e481e87 to 1557103 Compare June 29, 2026 21:36
@philberty

Copy link
Copy Markdown
Member

merge conflicts again

@lucasly-ba
lucasly-ba force-pushed the type-alias-bounds branch 3 times, most recently from 0e855a7 to 5af0f50 Compare July 8, 2026 22:30
Warn on bounds applied to the generic parameters of a type alias, as
those bounds are not enforced.

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_unused.

gcc/testsuite/ChangeLog:

	* rust/compile/type-alias-bounds_0.rs: New test.

Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
@lucasly-ba
lucasly-ba force-pushed the type-alias-bounds branch from 5af0f50 to 2f0f086 Compare July 9, 2026 13:35
@lucasly-ba

Copy link
Copy Markdown
Contributor Author

@philberty should be good

@lucasly-ba

Copy link
Copy Markdown
Contributor Author

@P-E-P

@philberty

Copy link
Copy Markdown
Member

mer conflicts.. just combine a few of these to make it easier

@lucasly-ba

Copy link
Copy Markdown
Contributor Author

@philberty just opened #4797

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants