]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: collector: Fix missing trait generics
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 28 Jun 2023 12:42:18 +0000 (14:42 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:33 +0000 (18:49 +0100)
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>
gcc/rust/ast/rust-ast-collector.cc
gcc/testsuite/rust/link/trait_import_0.rs

index ffd5311caa16a55877510dc9a8da5776a46d9d2f..84ebcad749ae141181a35136a5e1ca09928bc71a 100644 (file)
@@ -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 (), {});
 }
index ac8c5811d22b40068fa9b462cfaa8b26f11edaf8..1b8c90a35742decd066ddc5be3c3c89ebab1b768 100644 (file)
@@ -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;