]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Struct are types, not values
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 24 Jan 2024 16:10:42 +0000 (17:10 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 1 Aug 2024 14:52:27 +0000 (16:52 +0200)
We shall search in the right namespace. The correct namespace for struct
is type namespace.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Change
search location for struct types.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/typecheck/rust-hir-type-check-item.cc

index 4ab946e1c2a1e2f7b164eb99352b6d3e3f0af434..3e504e5df3221742cfadc07a870d1e27e43c480f 100644 (file)
@@ -279,9 +279,11 @@ TypeCheckItem::visit (HIR::StructStruct &struct_decl)
     {
       auto nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
-      auto canonical_path = nr_ctx.values.to_canonical_path (
+      auto canonical_path = nr_ctx.types.to_canonical_path (
        struct_decl.get_mappings ().get_nodeid ());
 
+      if (!canonical_path.has_value ())
+       rust_unreachable ();
       path = canonical_path.value ();
     }
   else