diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-01-15 12:59:51 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-24 13:06:52 +0100 |
commit | a7914fcc4f9d0e99679b353ca20c631659dbf870 (patch) | |
tree | 6bc8eec059c601b0d60682e8cd589a4929c06dc5 /gcc | |
parent | 9b784c352bad4626ab4f15935d27f2a81866527b (diff) | |
download | gcc-a7914fcc4f9d0e99679b353ca20c631659dbf870.zip gcc-a7914fcc4f9d0e99679b353ca20c631659dbf870.tar.gz gcc-a7914fcc4f9d0e99679b353ca20c631659dbf870.tar.bz2 |
gccrs: 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.cc | 6 | ||||
-rw-r--r-- | gcc/rust/ast/rust-ast-builder.h | 4 |
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 47044df..567e6c4 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<GenericParam> -Builder::new_type_param (TypeParam ¶m) +Builder::new_type_param ( + TypeParam ¶m, 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 ¶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 e5bae6e..3b9990a 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 ¶m); - static std::unique_ptr<GenericParam> new_type_param (TypeParam ¶m); + static std::unique_ptr<GenericParam> new_type_param ( + TypeParam ¶m, + std::vector<std::unique_ptr<TypeParamBound>> extra_trait_bounds = {}); static Lifetime new_lifetime (const Lifetime &lifetime); |