diff mbox series

[committed,051/103] gccrs: Add missing name resolution to Function type-path segments

Message ID 20230221120230.596966-52-arthur.cohen@embecosm.com
State New
Headers show
Series [committed,001/103] gccrs: Fix missing dead code analysis ICE on local enum definition | expand

Commit Message

Arthur Cohen Feb. 21, 2023, 12:01 p.m. UTC
From: Philip Herron <philip.herron@embecosm.com>

gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Add missing handling of
	function case.
---
 gcc/rust/resolve/rust-ast-resolve-type.cc | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index d227b8b539a..e5c712aba07 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -149,7 +149,20 @@  ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
 	  break;
 
 	case AST::TypePathSegment::SegmentType::FUNCTION:
-	  gcc_unreachable ();
+	  AST::TypePathSegmentFunction *fnseg
+	    = static_cast<AST::TypePathSegmentFunction *> (segment.get ());
+
+	  AST::TypePathFunction &fn = fnseg->get_type_path_function ();
+	  for (auto &param : fn.get_params ())
+	    {
+	      ResolveType::go (param.get ());
+	    }
+
+	  if (fn.has_return_type ())
+	    {
+	      ResolveType::go (fn.get_return_type ().get ());
+	    }
+
 	  break;
 	}