[COMMITTED,086/101] gccrs: ast: Lower 'for' lifetimes

Message ID 20240130121026.807464-89-arthur.cohen@embecosm.com
State Committed
Commit d8e8ad5493848a3b8f5883817770da2aba5d3edd
Headers
Series [COMMITTED,001/101] gccrs: Add visibility to trait item |

Commit Message

Arthur Cohen Jan. 30, 2024, 12:07 p.m. UTC
  From: Jakub Dupak <dev@jakubdupak.com>

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): For lifetimes.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
---
 gcc/rust/hir/rust-ast-lower-type.cc | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc
index 5cea71f83a2..a0178ebf490 100644
--- a/gcc/rust/hir/rust-ast-lower-type.cc
+++ b/gcc/rust/hir/rust-ast-lower-type.cc
@@ -199,6 +199,13 @@  ASTLoweringType::visit (AST::BareFunctionType &fntype)
 {
   bool is_variadic = false;
   std::vector<HIR::LifetimeParam> lifetime_params;
+  for (auto &lifetime_param : fntype.get_for_lifetimes ())
+    {
+      auto generic_param = ASTLowerGenericParam::translate (&lifetime_param);
+      lifetime_params.push_back (
+	*static_cast<HIR::LifetimeParam *> (generic_param));
+    }
+
   HIR::FunctionQualifiers qualifiers
     = lower_qualifiers (fntype.get_function_qualifiers ());