Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccrs: fix unconstrained generics check to handle recursive generics #3434

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

philberty
Copy link
Member

Generics can be constrained within other generic types so this check needs to be recursive.

Fixes #3031

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): recursive walker
* typecheck/rust-tyty.cc (BaseType::get_subst_argument_mappings): new helper
* typecheck/rust-tyty.h: prototype

gcc/testsuite/ChangeLog:

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

@philberty philberty added bug diagnostic diagnostic static analysis labels Feb 13, 2025
@philberty philberty added this to the Remaining typecheck issues milestone Feb 13, 2025
Generics can be constrained within other generic types so this check needs
to be recursive.

Fixes #3031

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): recursive walker
	* typecheck/rust-tyty.cc (BaseType::get_subst_argument_mappings): new helper
	* typecheck/rust-tyty.h: prototype

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
@philberty philberty added this pull request to the merge queue Feb 13, 2025
Merged via the queue into master with commit 5f7213e Feb 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Invalid "unconstrained type parameter" error
1 participant