diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-06-28 14:42:18 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-07-07 13:46:54 +0000 |
commit | ee95b41c072fbcec63df1ac8f8a67ee3996e9ac8 (patch) | |
tree | 6772f30a4cab1436f255c8a83c3611ec31fcefa9 /gcc | |
parent | dc6fb87fcfec2ce551ef0738d99642bcf8e3331e (diff) | |
download | gcc-ee95b41c072fbcec63df1ac8f8a67ee3996e9ac8.zip gcc-ee95b41c072fbcec63df1ac8f8a67ee3996e9ac8.tar.gz gcc-ee95b41c072fbcec63df1ac8f8a67ee3996e9ac8.tar.bz2 |
collector: Fix missing trait generics
Generics on the target structure did not correctly output.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix generic
output.
gcc/testsuite/ChangeLog:
* rust/link/trait_import_0.rs: Mark test as xfail.
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 | 9 | ||||
-rw-r--r-- | gcc/testsuite/rust/link/trait_import_0.rs | 3 |
2 files changed, 4 insertions, 8 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index ffd5311..84ebcad 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -2117,14 +2117,7 @@ TokenCollector::visit (Trait &trait) push (Rust::Token::make (TRAIT, trait.get_locus ())); push (Rust::Token::make_identifier (Location (), std::move (id))); - // Traits actually have an implicit Self thrown at the start, so we must - // expect the number of generic params to be > 1 - if (trait.get_generic_params ().size () > 1) - { - push (Rust::Token::make (LEFT_ANGLE, Location ())); - visit_items_joined_by_separator (trait.get_generic_params (), COMMA, 1); - push (Rust::Token::make (RIGHT_ANGLE, Location ())); - } + visit (trait.get_generic_params ()); visit_items_as_block (trait.get_trait_items (), {}); } diff --git a/gcc/testsuite/rust/link/trait_import_0.rs b/gcc/testsuite/rust/link/trait_import_0.rs index ac8c581..1b8c90a 100644 --- a/gcc/testsuite/rust/link/trait_import_0.rs +++ b/gcc/testsuite/rust/link/trait_import_0.rs @@ -1,3 +1,6 @@ +// { dg-xfail-if "https://github.com/Rust-GCC/gccrs/issues/2349" { *-*-* } } +// { dg-excess-errors "" { xfail *-*-* } } + extern crate trait_import_1; use trait_import_1::Add; |