diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-06-28 15:54:12 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:49:34 +0100 |
commit | 5c9b490bc281f0819a3c2e199f5e7048694ce6cc (patch) | |
tree | f99fcb2d340472a951c5a6365b47963e16056def /gcc | |
parent | ce1ca503d2baf64633f807c70dcfc1d10e264578 (diff) | |
download | gcc-5c9b490bc281f0819a3c2e199f5e7048694ce6cc.zip gcc-5c9b490bc281f0819a3c2e199f5e7048694ce6cc.tar.gz gcc-5c9b490bc281f0819a3c2e199f5e7048694ce6cc.tar.bz2 |
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 <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-ast-collector.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index 88a25f0..f1306e7 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<TokenId, TokenId> |