]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Compile unit struct with constructor
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 13 Jan 2025 17:26:37 +0000 (18:26 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:06:57 +0000 (13:06 +0100)
gcc/rust/ChangeLog:

* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Do
not use query system for unit struct but compile it's constructor
instead.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/backend/rust-compile-resolve-path.cc

index a40f5542a683560421280aaa861bfc56a5777752..103f0cb6fe86eb9596f2a00f4e58e177efaf8705 100644 (file)
@@ -180,6 +180,11 @@ ResolvePathRef::resolve_with_node_id (
        }
     }
 
+  // Handle unit struct
+  if (lookup->get_kind () == TyTy::TypeKind::ADT)
+    return attempt_constructor_expression_lookup (lookup, ctx, mappings,
+                                                 expr_locus);
+
   // let the query system figure it out
   tree resolved_item = query_compile (ref, lookup, final_segment, mappings,
                                      expr_locus, is_qualified_path);