aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2025-01-15 12:59:51 +0000
committerCohenArthur <arthur.cohen@embecosm.com>2025-01-21 13:54:14 +0000
commitc53c8d70e8dce2a400c1f3a01343f5d550ea3a03 (patch)
treec5d86932faeefab953b860eac56f1533645e781a /gcc
parentc84c92ac0fa33bb8bc2f01aa74d0fd15302913a1 (diff)
downloadgcc-c53c8d70e8dce2a400c1f3a01343f5d550ea3a03.zip
gcc-c53c8d70e8dce2a400c1f3a01343f5d550ea3a03.tar.gz
gcc-c53c8d70e8dce2a400c1f3a01343f5d550ea3a03.tar.bz2
ast-builder: Add extra parameter for TypeParam builder
gcc/rust/ChangeLog: * ast/rust-ast-builder.cc (Builder::new_type_param): Add optional extra trait bounds. * ast/rust-ast-builder.h: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-builder.cc6
-rw-r--r--gcc/rust/ast/rust-ast-builder.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast-builder.cc b/gcc/rust/ast/rust-ast-builder.cc
index eccc474..b3ee387ef 100644
--- a/gcc/rust/ast/rust-ast-builder.cc
+++ b/gcc/rust/ast/rust-ast-builder.cc
@@ -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 ())
diff --git a/gcc/rust/ast/rust-ast-builder.h b/gcc/rust/ast/rust-ast-builder.h
index 7e224d3..372e355 100644
--- a/gcc/rust/ast/rust-ast-builder.h
+++ b/gcc/rust/ast/rust-ast-builder.h
@@ -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);