From: arthur.cohen@embecosm.com
To: gcc-patches@gcc.gnu.org
Cc: gcc-rust@gcc.gnu.org, Owen Avery <powerboat9.gamer@gmail.com>
Subject: [COMMITTED 016/146] gccrs: Remove usage of Resolver::get_builtin_types
Date: Fri, 21 Mar 2025 13:05:17 +0100 [thread overview]
Message-ID: <20250321123226.184882-17-arthur.cohen@embecosm.com> (raw)
In-Reply-To: <20250321123226.184882-1-arthur.cohen@embecosm.com>
From: Owen Avery <powerboat9.gamer@gmail.com>
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 | 15 ++-------------
gcc/rust/typecheck/rust-hir-type-check.h | 1 +
gcc/rust/typecheck/rust-typecheck-context.cc | 6 ++++++
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/gcc/rust/backend/rust-compile-context.cc b/gcc/rust/backend/rust-compile-context.cc
index c80f95649f1..86f089440ac 100644
--- a/gcc/rust/backend/rust-compile-context.cc
+++ b/gcc/rust/backend/rust-compile-context.cc
@@ -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
diff --git a/gcc/rust/typecheck/rust-hir-type-check.h b/gcc/rust/typecheck/rust-hir-type-check.h
index fa49e0689f3..5b1fe220890 100644
--- a/gcc/rust/typecheck/rust-hir-type-check.h
+++ b/gcc/rust/typecheck/rust-hir-type-check.h
@@ -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);
diff --git a/gcc/rust/typecheck/rust-typecheck-context.cc b/gcc/rust/typecheck/rust-typecheck-context.cc
index 8f7a8a4f48f..0fb8224861e 100644
--- a/gcc/rust/typecheck/rust-typecheck-context.cc
+++ b/gcc/rust/typecheck/rust-typecheck-context.cc
@@ -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)
--
2.45.2
next prev parent reply other threads:[~2025-03-21 12:33 UTC|newest]
Thread overview: 147+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 12:05 [PATCHSET] Update Rust frontend 21/03/2024 3/4 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 001/146] gccrs: Fix bad recursive operator overload call arthur.cohen
2025-03-21 12:05 ` [COMMITTED 002/146] gccrs: Insert trait names during toplevel resolution 2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 003/146] gccrs: Fix variable shadowing in late " arthur.cohen
2025-03-21 12:05 ` [COMMITTED 004/146] gccrs: Add a newline to the end of nr2/exclude arthur.cohen
2025-03-21 12:05 ` [COMMITTED 005/146] gccrs: Rename some PathIdentSegment functions arthur.cohen
2025-03-21 12:05 ` [COMMITTED 006/146] gccrs: Use name resolution 2.0 in TraitItemReference arthur.cohen
2025-03-21 12:05 ` [COMMITTED 007/146] gccrs: Use name resolver 2.0 in CompileTraitItem arthur.cohen
2025-03-21 12:05 ` [COMMITTED 008/146] gccrs: Improve path handling while testing name resolution 2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 009/146] gccrs: Fix name resolution 2.0 definition lookups in unsafe checker arthur.cohen
2025-03-21 12:05 ` [COMMITTED 010/146] rust: Desugar IfLet* into MatchExpr arthur.cohen
2025-03-21 12:05 ` [COMMITTED 011/146] gccrs: Use name resolution 2.0 in TraitResolver arthur.cohen
2025-03-21 12:05 ` [COMMITTED 012/146] gccrs: Resolve SelfParam in name resolution 2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 013/146] gccrs: add test case to show method resolution is working arthur.cohen
2025-03-21 12:05 ` [COMMITTED 014/146] gccrs: Make TyTy::TupleType::get_unit_type cache its return value arthur.cohen
2025-03-21 12:05 ` [COMMITTED 015/146] gccrs: fix bad type inferencing on path's arthur.cohen
2025-03-21 12:05 ` arthur.cohen [this message]
2025-03-21 12:05 ` [COMMITTED 017/146] gccrs: Improve handling of struct expressions in nr2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 018/146] gccrs: fix bad type inference on local patterns arthur.cohen
2025-03-21 12:05 ` [COMMITTED 019/146] gccrs: Use name resolver 2.0 in VisibilityResolver arthur.cohen
2025-03-21 12:05 ` [COMMITTED 020/146] gccrs: Use name resolver 2.0 for module descendance checks arthur.cohen
2025-03-21 12:05 ` [COMMITTED 021/146] gccrs: Reorganize the CPU feature detection arthur.cohen
2025-03-21 12:05 ` [COMMITTED 022/146] gccrs: fix ICE for placeholder which is not setup arthur.cohen
2025-03-21 12:05 ` [COMMITTED 023/146] gccrs: fix typechecking of Fn trait calls using ADT types arthur.cohen
2025-03-21 12:05 ` [COMMITTED 024/146] gccrs: Improve handling of implicit Self parameter in AST arthur.cohen
2025-03-21 12:05 ` [COMMITTED 025/146] gccrs: add test case to show issue is fixed arthur.cohen
2025-03-21 12:05 ` [COMMITTED 026/146] gccrs: hir: Mark AttrVec::get_outer_attrs as override arthur.cohen
2025-03-21 12:05 ` [COMMITTED 027/146] gccrs: typecheck: Remove unused parameter in TyTyCheckCallExpr arthur.cohen
2025-03-21 12:05 ` [COMMITTED 028/146] gccrs: asm: Fix clang warnings arthur.cohen
2025-03-21 12:05 ` [COMMITTED 029/146] gccrs: Fix bad handling for recursive type query arthur.cohen
2025-03-21 12:05 ` [COMMITTED 030/146] gccrs: Push ribs by kind rather than by value arthur.cohen
2025-03-21 12:05 ` [COMMITTED 031/146] gccrs: Improve handling of static items in toplevel 2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 032/146] gccrs: Refactor HIR to reduce the amount of raw pointers arthur.cohen
2025-03-21 12:05 ` [COMMITTED 033/146] gccrs: Refactor HIR with optionals, references & newtypes arthur.cohen
2025-03-21 12:05 ` [COMMITTED 034/146] gccrs: Refactor hir to avoid raw pointers and unneeded fwd arthur.cohen
2025-03-21 12:05 ` [COMMITTED 035/146] gccrs: Fixes some tests appearing with a moved variant arthur.cohen
2025-03-21 12:05 ` [COMMITTED 036/146] gccrs: Fix Generic type retrieval arthur.cohen
2025-03-21 12:05 ` [COMMITTED 037/146] gccrs: FnParam cloning now keeps projections arthur.cohen
2025-03-21 12:05 ` [COMMITTED 038/146] gccrs: Refactor optional initializers arthur.cohen
2025-03-21 12:05 ` [COMMITTED 039/146] gccrs: Fix FnParam pattern location ternary logic arthur.cohen
2025-03-21 12:05 ` [COMMITTED 040/146] gccrs: Add optional template arguments to please GCC4.8 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 041/146] gccrs: Use default constructor for default arguments arthur.cohen
2025-03-21 12:05 ` [COMMITTED 042/146] gccrs: Use a reference wrapper to please GCC 4.8 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 043/146] gccrs: Use nr2.0 in PrivacyReporter arthur.cohen
2025-03-21 12:05 ` [COMMITTED 044/146] gccrs: Handle type path segments during late resolution 2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 045/146] gccrs: Use nr2.0 in typechecker arthur.cohen
2025-03-21 12:05 ` [COMMITTED 046/146] gccrs: Clean up some system includes arthur.cohen
2025-03-21 12:05 ` [COMMITTED 047/146] gccrs: fix crashes in hir dump since move to references arthur.cohen
2025-03-21 12:05 ` [COMMITTED 048/146] gccrs: empty match expressions should resolve to ! arthur.cohen
2025-03-21 12:05 ` [COMMITTED 049/146] gccrs: Prevent execution of some nr1.0 functions with nr2.0 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 050/146] gccrs: Prepend crate name to functions with nr2 arthur.cohen
2025-03-21 12:05 ` [COMMITTED 051/146] gccrs: fix crash in hir dump with missing guards arthur.cohen
2025-03-21 12:05 ` [COMMITTED 052/146] gccrs: improve handling of Self Type paths arthur.cohen
2025-03-21 12:05 ` [COMMITTED 053/146] gccrs: allow casts from numeric types to floats arthur.cohen
2025-03-21 12:05 ` [COMMITTED 054/146] gccrs: ensure packed and aligned is applied properly arthur.cohen
2025-03-21 12:05 ` [COMMITTED 055/146] gccrs: lang-items: Move comment about arithmetic lang items arthur.cohen
2025-03-21 12:05 ` [COMMITTED 056/146] gccrs: mappings: Move lang_item definitions to .cc arthur.cohen
2025-03-21 12:05 ` [COMMITTED 057/146] gccrs: hir: Remove duplicate function in TraitItemFunc arthur.cohen
2025-03-21 12:05 ` [COMMITTED 058/146] gccrs: stacked-contexts: Add peek() method arthur.cohen
2025-03-21 12:06 ` [COMMITTED 059/146] gccrs: ast: Use StackedContexts class in ContextualASTVisitor arthur.cohen
2025-03-21 12:06 ` [COMMITTED 060/146] gccrs: Remove bad assertion in name resolution arthur.cohen
2025-03-21 12:06 ` [COMMITTED 061/146] gccrs: constant evaluation like these are coercion sites arthur.cohen
2025-03-21 12:06 ` [COMMITTED 062/146] gccrs: add checks for division by zero and left shift overflow arthur.cohen
2025-03-21 12:06 ` [COMMITTED 063/146] gccrs: add test case to show issue is fixed arthur.cohen
2025-03-21 12:06 ` [COMMITTED 064/146] gccrs: fix crash in hir dump arthur.cohen
2025-03-21 12:06 ` [COMMITTED 065/146] gccrs: lang-items: Store NodeId mappings for lang items arthur.cohen
2025-03-21 12:06 ` [COMMITTED 066/146] gccrs: lang-items: Add lang-items AST collector arthur.cohen
2025-03-21 12:06 ` [COMMITTED 067/146] gccrs: attributes: Add class for sharing methods on attributes arthur.cohen
2025-03-21 12:06 ` [COMMITTED 068/146] gccrs: type-check: Remove unused capture in nr2.0 arthur.cohen
2025-03-21 12:06 ` [COMMITTED 069/146] gccrs: Fix ForeverStack::find_starting_point output parameter arthur.cohen
2025-03-21 12:06 ` [COMMITTED 070/146] gccrs: ast: Add LangItemPath class arthur.cohen
2025-03-21 12:06 ` [COMMITTED 071/146] gccrs: derive(Copy): Use new LangItemPath arthur.cohen
2025-03-21 12:06 ` [COMMITTED 072/146] gccrs: hir: Start adapting visitors to accept multiple kinds of Paths arthur.cohen
2025-03-21 12:06 ` [COMMITTED 073/146] gccrs: nr1.0: Resolve lang item paths properly arthur.cohen
2025-03-21 12:06 ` [COMMITTED 074/146] gccrs: hir: Lower lang-item paths arthur.cohen
2025-03-21 12:06 ` [COMMITTED 075/146] gccrs: nr2.0: Resolve lang item paths properly arthur.cohen
2025-03-21 12:06 ` [COMMITTED 076/146] gccrs: lang-item: Remove unused NodeId from LangItemPath arthur.cohen
2025-03-21 12:06 ` [COMMITTED 077/146] gccrs: fix bad not expression in rust arthur.cohen
2025-03-21 12:06 ` [COMMITTED 078/146] gccrs: implement the TuplePattern and use it for function patterns arthur.cohen
2025-03-21 12:06 ` [COMMITTED 079/146] gccrs: Made changes to AST::TraitImpl constructor for TypePath arthur.cohen
2025-03-21 12:06 ` [COMMITTED 080/146] gccrs: add ptr to int and int to ptr type cast rules arthur.cohen
2025-03-21 12:06 ` [COMMITTED 081/146] gccrs: typecheck-path: Fix typo (reciever -> receiver) arthur.cohen
2025-03-21 12:06 ` [COMMITTED 082/146] gccrs: parser: Add testcases for multiline strings arthur.cohen
2025-03-21 12:06 ` [COMMITTED 083/146] gccrs: resolve: Name resolve trait bounds properly arthur.cohen
2025-03-21 12:06 ` [COMMITTED 084/146] gccrs: typecheck: Add note about erorring out on additional trait bounds arthur.cohen
2025-03-21 12:06 ` [COMMITTED 085/146] gccrs: lang-item: Add Sync trait arthur.cohen
2025-03-21 12:06 ` [COMMITTED 086/146] gccrs: lang-item: Add Option::{None, Some}, Iterator::next, IntoIter::into_iter arthur.cohen
2025-03-21 12:06 ` [COMMITTED 087/146] gccrs: lang-items: Collect trait functions that are lang items arthur.cohen
2025-03-21 12:06 ` [COMMITTED 088/146] gccrs: ast: Add new constructors for PathInExpression arthur.cohen
2025-03-21 12:06 ` [COMMITTED 089/146] gccrs: ast-builder: Add more methods arthur.cohen
2025-03-21 12:06 ` [COMMITTED 090/146] gccrs: Fix NR2.0 compiler ICE caused by Generics in Enums arthur.cohen
2025-03-21 12:06 ` [COMMITTED 091/146] gccrs: nr2.0: Handle "Self" properly in trait definitions arthur.cohen
2025-03-21 12:06 ` [COMMITTED 092/146] gccrs: ast: Add EnumItem::Kind arthur.cohen
2025-03-21 12:06 ` [COMMITTED 093/146] gccrs: Remove Rust::make_unique arthur.cohen
2025-03-21 12:06 ` [COMMITTED 094/146] gccrs: lower: Correctly lower parenthesized types arthur.cohen
2025-03-21 12:06 ` [COMMITTED 095/146] gccrs: tychk: Add more support for additional trait bounds in functions arthur.cohen
2025-03-21 12:06 ` [COMMITTED 096/146] gccrs: nr2.0: Resolve type aliases inside trait definitions arthur.cohen
2025-03-21 12:06 ` [COMMITTED 097/146] gccrs: ast: Add new Kind enums for more precise downcasting arthur.cohen
2025-03-21 12:06 ` [COMMITTED 098/146] gccrs: use StackedContexts for block context arthur.cohen
2025-03-21 12:06 ` [COMMITTED 099/146] gccrs: fix ICE during HIR dump arthur.cohen
2025-03-21 12:06 ` [COMMITTED 100/146] gccrs: nr2.0: Improve default, top-level, and late resolvers arthur.cohen
2025-03-21 12:06 ` [COMMITTED 101/146] gccrs: fix ICE in borrows to invalid expressions arthur.cohen
2025-03-21 12:06 ` [COMMITTED 102/146] gccrs: add support for lang_item eq and PartialEq trait arthur.cohen
2025-03-21 12:06 ` [COMMITTED 103/146] gccrs: fix ICE with hir dump on closure arthur.cohen
2025-03-21 12:06 ` [COMMITTED 104/146] gccrs: nr2.0: Resolve Self inside impl blocks arthur.cohen
2025-03-21 12:06 ` [COMMITTED 105/146] gccrs: cleanup our enum type layout to be closer to rustc arthur.cohen
2025-03-21 12:06 ` [COMMITTED 106/146] gccrs: Allow float type to be casted as integer type arthur.cohen
2025-03-21 12:06 ` [COMMITTED 107/146] gccrs: match arms are a LUB arthur.cohen
2025-03-21 12:06 ` [COMMITTED 108/146] gccrs: rust/intrinsic: add try intrinsic and panic strategy options arthur.cohen
2025-03-21 12:06 ` [COMMITTED 109/146] gccrs: rust/intrinsic: add new "catch_unwind" variant of API arthur.cohen
2025-03-21 12:06 ` [COMMITTED 110/146] gccrs: add two more tests to test try-catch (unwind) code generation arthur.cohen
2025-03-21 12:06 ` [COMMITTED 111/146] gccrs: Visit the trait paths of trait implementations arthur.cohen
2025-03-21 12:06 ` [COMMITTED 112/146] gccrs: improve mutability checks arthur.cohen
2025-03-21 12:06 ` [COMMITTED 113/146] gccrs: gcc/rust/ChangeLog: arthur.cohen
2025-03-21 12:06 ` [COMMITTED 114/146] gccrs: Add ForeverStackStore arthur.cohen
2025-03-21 12:06 ` [COMMITTED 115/146] gccrs: testsuite: Fix missing handling of little endian arthur.cohen
2025-03-21 12:06 ` [COMMITTED 116/146] gccrs: Fix scan-gimple testcases on LE platforms arthur.cohen
2025-03-21 12:06 ` [COMMITTED 117/146] gccrs: Revert "gcc/rust/ChangeLog:" arthur.cohen
2025-03-21 12:06 ` [COMMITTED 118/146] gccrs: Add missing name resolution to static items in blocks arthur.cohen
2025-03-21 12:07 ` [COMMITTED 119/146] gccrs: nr2.0: Early resolve pending eager macro invocations arthur.cohen
2025-03-21 12:07 ` [COMMITTED 120/146] gccrs: Remove dead code related to external functions arthur.cohen
2025-03-21 12:07 ` [COMMITTED 121/146] gccrs: ast: Fix warning about copy elision for moved expr arthur.cohen
2025-03-21 12:07 ` [COMMITTED 122/146] gccrs: attributes: Add #[derive] as a built-in attribute arthur.cohen
2025-03-21 12:07 ` [COMMITTED 123/146] gccrs: collect-lang-items: Display attribute upon error finding it arthur.cohen
2025-03-21 12:07 ` [COMMITTED 124/146] gccrs: ast: Refactor how lang item paths are handled arthur.cohen
2025-03-21 12:07 ` [COMMITTED 125/146] gccrs: tychk: resolve lang item type paths properly arthur.cohen
2025-03-21 12:07 ` [COMMITTED 126/146] gccrs: lower: Properly lower non-generic lang item type path segments arthur.cohen
2025-03-21 12:07 ` [COMMITTED 127/146] gccrs: lang-items: Collect struct lang items arthur.cohen
2025-03-21 12:07 ` [COMMITTED 128/146] gccrs: lang-item: Add LangItem::PrettyString arthur.cohen
2025-03-21 12:07 ` [COMMITTED 129/146] gccrs: mappings: Add get_lang_item_node arthur.cohen
2025-03-21 12:07 ` [COMMITTED 130/146] gccrs: ast-collector: Adapt to lang item type path segments arthur.cohen
2025-03-21 12:07 ` [COMMITTED 131/146] gccrs: ast-collector: Fix tuple struct pattern collection arthur.cohen
2025-03-21 12:07 ` [COMMITTED 132/146] gccrs: lang-items: Mark Clone trait as a lang item in testsuite arthur.cohen
2025-03-21 12:07 ` [COMMITTED 133/146] gccrs: builder: Allow generating struct statements arthur.cohen
2025-03-21 12:07 ` [COMMITTED 134/146] gccrs: derive(Clone): Manually generate AssertParamIsCopy struct for unions arthur.cohen
2025-03-21 12:07 ` [COMMITTED 135/146] gccrs: derive(Clone): Mark PhantomData as a lang item arthur.cohen
2025-03-21 12:07 ` [COMMITTED 136/146] gccrs: derive(Copy): Use copy lang item when deriving Copy arthur.cohen
2025-03-21 12:07 ` [COMMITTED 137/146] gccrs: ast-builder: Add new methods around type paths arthur.cohen
2025-03-21 12:07 ` [COMMITTED 138/146] gccrs: derive(Clone): Use lang item for PhantomData in Clone arthur.cohen
2025-03-21 12:07 ` [COMMITTED 139/146] gccrs: derive(Clone): Add note about Clone::clone() arthur.cohen
2025-03-21 12:07 ` [COMMITTED 140/146] gccrs: derive(Clone): Improve existing testcase arthur.cohen
2025-03-21 12:07 ` [COMMITTED 141/146] gccrs: derive(Clone): Add deriving of simple enum variants arthur.cohen
2025-03-21 12:07 ` [COMMITTED 142/146] gccrs: ast-builder: Add new methods for building structs arthur.cohen
2025-03-21 12:07 ` [COMMITTED 143/146] gccrs: derive(Clone): Implement clone for enum tuple variants arthur.cohen
2025-03-21 12:07 ` [COMMITTED 144/146] gccrs: derive(Clone): Implement derive clone for enum struct variants arthur.cohen
2025-03-21 12:07 ` [COMMITTED 145/146] gccrs: derive(Clone): Add lang item typepaths failure testcases to nr2 exclude arthur.cohen
2025-03-21 12:07 ` [COMMITTED 146/146] gccrs: nr2.0: late: Better format PathInExpression resolution arthur.cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250321123226.184882-17-arthur.cohen@embecosm.com \
--to=arthur.cohen@embecosm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc-rust@gcc.gnu.org \
--cc=powerboat9.gamer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).