Skip to content

Commit d47331f

Browse files
committed
Add trait type param bounds to ast token collector
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]>
1 parent 70793ad commit d47331f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gcc/rust/ast/rust-ast-collector.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,11 @@ TokenCollector::visit (Trait &trait)
24492449
push (Rust::Token::make (TRAIT, trait.get_locus ()));
24502450
push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
24512451

2452-
visit (trait.get_generic_params ());
2452+
if (trait.has_generics ())
2453+
visit (trait.get_generic_params ());
2454+
if (!trait.get_type_param_bounds ().empty ())
2455+
push (Rust::Token::make ((COLON), trait.get_locus ()));
2456+
visit_items_joined_by_separator (trait.get_type_param_bounds (), PLUS);
24532457

24542458
visit_items_as_block (trait.get_trait_items (), {});
24552459
});

0 commit comments

Comments
 (0)