]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast-builder: Add extra parameter for TypeParam builder
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 15 Jan 2025 12:59:51 +0000 (12:59 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:06:52 +0000 (13:06 +0100)
gcc/rust/ChangeLog:

* ast/rust-ast-builder.cc (Builder::new_type_param): Add optional extra trait bounds.
* ast/rust-ast-builder.h: Likewise.

gcc/rust/ast/rust-ast-builder.cc
gcc/rust/ast/rust-ast-builder.h

index 47044df91714ebf9b5cae4122ca408f7bb1a4ff1..567e6c4350952ed8637b3ea76c5ac24c7feb0bf2 100644 (file)
@@ -361,7 +361,8 @@ Builder::new_lifetime_param (LifetimeParam &param)
 }
 
 std::unique_ptr<GenericParam>
-Builder::new_type_param (TypeParam &param)
+Builder::new_type_param (
+  TypeParam &param, std::vector<std::unique_ptr<TypeParamBound>> extra_bounds)
 {
   location_t locus = param.get_locus ();
   AST::AttrVec outer_attrs = param.get_outer_attrs ();
@@ -372,6 +373,9 @@ Builder::new_type_param (TypeParam &param)
   if (param.has_type ())
     type = new_type (param.get_type ());
 
+  for (auto &&extra_bound : extra_bounds)
+    type_param_bounds.emplace_back (std::move (extra_bound));
+
   for (const auto &b : param.get_type_param_bounds ())
     {
       switch (b->get_bound_type ())
index e5bae6ed6e95aa9b0e2801ea9276e8ec2034de89..3b9990a4969ac6a43c4eace50c17601ee66c56bf 100644 (file)
@@ -200,7 +200,9 @@ public:
   static std::unique_ptr<GenericParam>
   new_lifetime_param (LifetimeParam &param);
 
-  static std::unique_ptr<GenericParam> new_type_param (TypeParam &param);
+  static std::unique_ptr<GenericParam> new_type_param (
+    TypeParam &param,
+    std::vector<std::unique_ptr<TypeParamBound>> extra_trait_bounds = {});
 
   static Lifetime new_lifetime (const Lifetime &lifetime);