public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8621] gccrs: AST: Fix for lifetime lowering
@ 2024-01-30 12:02 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-30 12:02 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4b13ec24b1abcaa735583a55b8fa564446aa57eb

commit r14-8621-g4b13ec24b1abcaa735583a55b8fa564446aa57eb
Author: Jakub Dupak <dev@jakubdupak.com>
Date:   Tue Jan 9 15:46:41 2024 +0100

    gccrs: AST: Fix for lifetime lowering
    
    gcc/rust/ChangeLog:
    
            * hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): fix for lifetimes
            (ASTLowerWhereClauseItem::visit): fix for lifetimes
    
    Signed-off-by: Jakub Dupak <dev@jakubdupak.com>

Diff:
---
 gcc/rust/hir/rust-ast-lower-type.cc | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc
index a0178ebf490e..504ca051f59a 100644
--- a/gcc/rust/hir/rust-ast-lower-type.cc
+++ b/gcc/rust/hir/rust-ast-lower-type.cc
@@ -529,8 +529,13 @@ ASTLoweringTypeBounds::translate (AST::TypeParamBound *type)
 void
 ASTLoweringTypeBounds::visit (AST::TraitBound &bound)
 {
-  // FIXME
-  std::vector<HIR::LifetimeParam> lifetimes;
+  std::vector<HIR::LifetimeParam> for_lifetimes;
+  for (auto &lifetime_param : bound.get_for_lifetimes ())
+    {
+      auto generic_param = ASTLowerGenericParam::translate (&lifetime_param);
+      for_lifetimes.push_back (
+	*static_cast<HIR::LifetimeParam *> (generic_param));
+    }
 
   AST::TypePath &ast_trait_path = bound.get_type_path ();
   HIR::TypePath *trait_path = ASTLowerTypePath::translate (ast_trait_path);
@@ -543,8 +548,9 @@ ASTLoweringTypeBounds::visit (AST::TraitBound &bound)
   BoundPolarity polarity = bound.has_opening_question_mark ()
 			     ? BoundPolarity::AntiBound
 			     : BoundPolarity::RegularBound;
-  translated = new HIR::TraitBound (mapping, *trait_path, bound.get_locus (),
-				    bound.is_in_parens (), polarity);
+  translated
+    = new HIR::TraitBound (mapping, *trait_path, bound.get_locus (),
+			   bound.is_in_parens (), polarity, for_lifetimes);
 }
 
 void
@@ -596,6 +602,13 @@ ASTLowerWhereClauseItem::visit (AST::TypeBoundWhereClauseItem &item)
   // FIXME
   std::vector<HIR::LifetimeParam> for_lifetimes;
 
+  for (auto &lifetime_param : item.get_for_lifetimes ())
+    {
+      auto generic_param = ASTLowerGenericParam::translate (&lifetime_param);
+      for_lifetimes.push_back (
+	*static_cast<HIR::LifetimeParam *> (generic_param));
+    }
+
   std::unique_ptr<HIR::Type> bound_type = std::unique_ptr<HIR::Type> (
     ASTLoweringType::translate (item.get_type ().get ()));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-30 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 12:02 [gcc r14-8621] gccrs: AST: Fix for lifetime lowering Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).