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

commit r15-8757-g4f6d40d323807417a4b0424d73d9a75191e6225d
Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
Date:   Mon Jan 13 18:26:37 2025 +0100

    gccrs: Compile unit struct with constructor
    
    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.pa...@embecosm.com>

Diff:
---
 gcc/rust/backend/rust-compile-resolve-path.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc 
b/gcc/rust/backend/rust-compile-resolve-path.cc
index a40f5542a683..103f0cb6fe86 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -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);

Reply via email to