From: Arthur Cohen Date: Wed, 15 Jan 2025 12:59:51 +0000 (+0000) Subject: ast-builder: Add extra parameter for TypeParam builder X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c53c8d70e8dce2a400c1f3a01343f5d550ea3a03;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/rust/ast/rust-ast-builder.cc b/gcc/rust/ast/rust-ast-builder.cc index eccc474187f..b3ee387ef9c 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 ¶m) } std::unique_ptr -Builder::new_type_param (TypeParam ¶m) +Builder::new_type_param ( + TypeParam ¶m, std::vector> 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 ¶m) 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 7e224d3db5f..372e355fa9b 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 new_lifetime_param (LifetimeParam ¶m); - static std::unique_ptr new_type_param (TypeParam ¶m); + static std::unique_ptr new_type_param ( + TypeParam ¶m, + std::vector> extra_trait_bounds = {}); static Lifetime new_lifetime (const Lifetime &lifetime);