From: Pierre-Emmanuel Patry <[email protected]>
Those tokens were not generated correctly from the AST and thus made
some macros erroneous.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Add colon and
type param bound tokens when collecting a trait ast node.
Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/d47331f13c3f16262ffa4fbe6f919b83f1056d7f
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4401
gcc/rust/ast/rust-ast-collector.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/ast/rust-ast-collector.cc
b/gcc/rust/ast/rust-ast-collector.cc
index 0ef5f06e5..15cd82d29 100644
--- a/gcc/rust/ast/rust-ast-collector.cc
+++ b/gcc/rust/ast/rust-ast-collector.cc
@@ -2449,7 +2449,11 @@ TokenCollector::visit (Trait &trait)
push (Rust::Token::make (TRAIT, trait.get_locus ()));
push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
- visit (trait.get_generic_params ());
+ if (trait.has_generics ())
+ visit (trait.get_generic_params ());
+ if (!trait.get_type_param_bounds ().empty ())
+ push (Rust::Token::make ((COLON), trait.get_locus ()));
+ visit_items_joined_by_separator (trait.get_type_param_bounds (), PLUS);
visit_items_as_block (trait.get_trait_items (), {});
});
--
2.52.0