public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Struct are types, not values
@ 2024-05-07 16:27 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2024-05-07 16:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:01f3f7b846504858c43a5d94b9d60109369648e1

commit 01f3f7b846504858c43a5d94b9d60109369648e1
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Jan 24 17:10:42 2024 +0100

    Struct are types, not values
    
    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>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-item.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc
index 4ab946e1c2a1..3e504e5df322 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-item.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-07 16:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 16:27 [gcc/devel/rust/master] Struct are types, not values Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).