From: Pierre-Emmanuel Patry Date: Wed, 28 Jun 2023 13:54:12 +0000 (+0200) Subject: gccrs: collector: Fix remaining trait & extern issues X-Git-Tag: basepoints/gcc-15~2378 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c9b490bc281f0819a3c2e199f5e7048694ce6cc;p=thirdparty%2Fgcc.git gccrs: collector: Fix remaining trait & extern issues Fix remaining failing tests with trait and extern. Outer attributes were missing and the semicolon did output on macro invocations. gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Fix external item trailing semicolon and outer attributes. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index 88a25f0b41fa..f1306e738fd6 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -2097,8 +2097,10 @@ TokenCollector::visit (TraitItemConst &item) void TokenCollector::visit (TraitItemType &item) { + visit_items_as_lines (item.get_outer_attrs ()); auto id = item.get_identifier ().as_string (); indentation (); + push (Rust::Token::make (TYPE, item.get_locus ())); push (Rust::Token::make_identifier (Location (), std::move (id))); push (Rust::Token::make (SEMICOLON, Location ())); @@ -2220,6 +2222,7 @@ TokenCollector::visit (ExternalFunctionItem &function) push (Rust::Token::make (RETURN_TYPE, Location ())); visit (function.get_return_type ()); } + push (Rust::Token::make (SEMICOLON, Location ())); } void @@ -2234,8 +2237,7 @@ TokenCollector::visit (ExternBlock &block) push (Rust::Token::make_string (Location (), std::move (abi))); } - visit_items_as_block (block.get_extern_items (), - {Rust::Token::make (SEMICOLON, Location ())}); + visit_items_as_block (block.get_extern_items (), {}); } static std::pair