]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add missing name resolution to Function type-path segments
authorPhilip Herron <philip.herron@embecosm.com>
Thu, 20 Oct 2022 16:59:03 +0000 (17:59 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:40 +0000 (12:36 +0100)
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

index d227b8b539acebab73dff8ef762bee879173eecb..e5c712aba070c1a3268ef68eeb5044dadb44eddd 100644 (file)
@@ -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;
        }