]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove usage of Resolver::get_builtin_types
authorOwen Avery <powerboat9.gamer@gmail.com>
Fri, 1 Nov 2024 16:58:44 +0000 (12:58 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:32:55 +0000 (12:32 +0100)
gcc/rust/ChangeLog:

* backend/rust-compile-context.cc
(Context::setup_builtins): Use TypeCheckContext::get_builtins
instead of Resolver::get_builtin_types,
TypeCheckContext::lookup_type_by_node_id, and
TypeCheckContext::lookup_type.
* typecheck/rust-hir-type-check.h
(TypeCheckContext::get_builtins): Add.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::get_builtins): Add.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-compile-context.cc
gcc/rust/typecheck/rust-hir-type-check.h
gcc/rust/typecheck/rust-typecheck-context.cc

index c80f95649f1226cf12aa447ffbe888a57a55f3d3..86f089440ac02dd723c1ae79e2c452c80957c0c9 100644 (file)
@@ -33,19 +33,8 @@ Context::Context ()
 void
 Context::setup_builtins ()
 {
-  auto builtins = resolver->get_builtin_types ();
-  for (auto it = builtins.begin (); it != builtins.end (); it++)
-    {
-      HirId ref;
-      bool ok = tyctx->lookup_type_by_node_id ((*it)->get_node_id (), &ref);
-      rust_assert (ok);
-
-      TyTy::BaseType *lookup;
-      ok = tyctx->lookup_type (ref, &lookup);
-      rust_assert (ok);
-
-      TyTyResolveCompile::compile (this, lookup);
-    }
+  for (auto &builtin : tyctx->get_builtins ())
+    TyTyResolveCompile::compile (this, builtin.get ());
 }
 
 hashval_t
index fa49e0689f301b1e32888a842349ad3e75890e05..5b1fe220890bb3d0a5a4bb94dc25bb69041b6258 100644 (file)
@@ -135,6 +135,7 @@ public:
   bool lookup_builtin (NodeId id, TyTy::BaseType **type);
   bool lookup_builtin (std::string name, TyTy::BaseType **type);
   void insert_builtin (HirId id, NodeId ref, TyTy::BaseType *type);
+  const std::vector<std::unique_ptr<TyTy::BaseType>> &get_builtins () const;
 
   void insert_type (const Analysis::NodeMapping &mappings,
                    TyTy::BaseType *type);
index 8f7a8a4f48f8867d1922733abc0a51fa3236e0b7..0fb8224861eaff92a3e048b2874b8a80e9561dae 100644 (file)
@@ -73,6 +73,12 @@ TypeCheckContext::insert_builtin (HirId id, NodeId ref, TyTy::BaseType *type)
   builtins.push_back (std::unique_ptr<TyTy::BaseType> (type));
 }
 
+const std::vector<std::unique_ptr<TyTy::BaseType>> &
+TypeCheckContext::get_builtins () const
+{
+  return builtins;
+}
+
 void
 TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
                               TyTy::BaseType *type)