gccrs: Fix parser handling for Foo<Bar: SomeTrait> - #4843
Merged
Conversation
The parser only recognized Foo<Bar = T> for the generic type bindings syntax. This parses both flavours now into update generic args type. Fixes #1726 gcc/rust/ChangeLog: * ast/rust-path.cc (GenericArgsBinding::as_string): new format * ast/rust-path.h (struct GenericArgsBinding): new kinds for bindings * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_binding): new * hir/tree/rust-hir-path.cc (GenericArgsBinding::GenericArgsBinding): likewise (GenericArgsBinding::operator=): likewise * hir/tree/rust-hir-path.h (class GenericArgsBinding): likewise * hir/tree/rust-hir.cc (GenericArgsBinding::to_string): likewise * parse/rust-parse-impl.hxx: peek for both types * typecheck/rust-type-util.cc (normalize_projection): track constrains * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): new ctor (TypeBoundPredicate::operator=): likewise * typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::get_constraint_args): new * typecheck/rust-tyty-subst.h: new * typecheck/rust-unify.cc (UnifyRules::expect_projection): fix loop gcc/testsuite/ChangeLog: * rust/compile/associated-type-bound.rs: New test. * rust/compile/issue-1726-1.rs: New test. * rust/compile/issue-1726-2.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
philberty
force-pushed
the
phil/generic-args
branch
from
September 3, 2026 19:10
697be02 to
65c3171
Compare
CohenArthur
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The parser only recognized Foo<Bar = T> for the generic type bindings syntax. This parses both flavours now into update generic args type.
Fixes #1726
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: