]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nr2.0: Remove accidental copies of resolver
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 21 Oct 2024 22:02:48 +0000 (18:02 -0400)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Mon, 3 Feb 2025 10:46:41 +0000 (10:46 +0000)
gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc
(CompileExpr::generate_closure_function): Take
NameResolutionContext by reference instead of by value.
* backend/rust-compile-item.cc
(CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::resolve): Likewise.
* checks/lints/rust-lint-marklive.cc
(MarkLive::find_ref_node_id): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_root_path): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_root_path): Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-compile-item.cc
gcc/rust/backend/rust-compile-resolve-path.cc
gcc/rust/checks/lints/rust-lint-marklive.cc
gcc/rust/typecheck/rust-hir-type-check-enumitem.cc
gcc/rust/typecheck/rust-hir-type-check-implitem.cc
gcc/rust/typecheck/rust-hir-type-check-item.cc
gcc/rust/typecheck/rust-hir-type-check-path.cc
gcc/rust/typecheck/rust-hir-type-check-type.cc

index 79383301f353f7dd45740fec8bea8d589bdc7fa4..a72156b6aa36246b5746271a73ea3cc6e5469a27 100644 (file)
@@ -2453,7 +2453,7 @@ CompileExpr::generate_closure_function (HIR::ClosureExpr &expr,
       auto body_mappings = function_body.get_mappings ();
       if (flag_name_resolution_2_0)
        {
-         auto nr_ctx
+         auto &nr_ctx
            = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
          auto candidate = nr_ctx.values.to_rib (body_mappings.get_nodeid ());
index 60159b63fd5bd7f17069259be7b2a803a7a80cba..2b6836ac39123f9a3f5a1844fecc2501e76eacfd 100644 (file)
@@ -52,7 +52,7 @@ CompileItem::visit (HIR::StaticItem &var)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path
@@ -119,7 +119,7 @@ CompileItem::visit (HIR::ConstantItem &constant)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path
@@ -192,7 +192,7 @@ CompileItem::visit (HIR::Function &function)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       auto path = nr_ctx.values.to_canonical_path (
index 07fa9b2acbf4ef972eef17a299c1d510adfb484c..c862a81e2124e60406382fa997e2d17baf70462c 100644 (file)
@@ -212,7 +212,7 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment,
   NodeId ref_node_id = UNKNOWN_NODEID;
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       auto resolved = nr_ctx.lookup (mappings.get_nodeid ());
index aacfc082cdf68fb9fbd1f05d8ded16dda7600743..270d0221bdb8529f1485106d1cea1d6d0bbfc566 100644 (file)
@@ -287,7 +287,7 @@ MarkLive::find_ref_node_id (NodeId ast_node_id, NodeId &ref_node_id)
 {
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       nr_ctx.lookup (ast_node_id).map ([&ref_node_id] (NodeId resolved) {
index ac850752f2d2f5d3038a4e3b3090902adcee9d0c..527c8dfbbeacecca199d4440a912c0626789ae6f 100644 (file)
@@ -83,7 +83,7 @@ TypeCheckEnumItem::visit (HIR::EnumItem &item)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path
@@ -127,7 +127,7 @@ TypeCheckEnumItem::visit (HIR::EnumItemDiscriminant &item)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path
@@ -189,7 +189,7 @@ TypeCheckEnumItem::visit (HIR::EnumItemTuple &item)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path
@@ -249,7 +249,7 @@ TypeCheckEnumItem::visit (HIR::EnumItemStruct &item)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path
index ee2c6b78452d26cda160be42f3f7a567f2980300..31164c1358a0a155092aad6bb94c801ad497fab0 100644 (file)
@@ -470,7 +470,7 @@ TypeCheckImplItem::visit (HIR::Function &function)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path = nr_ctx.values.to_canonical_path (
index 17c331e9a21a5200c00fb6b6a4d7211d8a35ec1d..eeea9b4fb1af68b8d912a5447d039cde2794df5f 100644 (file)
@@ -200,7 +200,7 @@ TypeCheckItem::visit (HIR::TupleStruct &struct_decl)
   // FIXME: HACK: ARTHUR: Disgusting
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       path = nr_ctx.values
@@ -280,7 +280,7 @@ TypeCheckItem::visit (HIR::StructStruct &struct_decl)
   // FIXME: HACK: ARTHUR: Disgusting
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
       auto canonical_path = nr_ctx.types.to_canonical_path (
        struct_decl.get_mappings ().get_nodeid ());
@@ -353,7 +353,7 @@ TypeCheckItem::visit (HIR::Enum &enum_decl)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path = nr_ctx.types.to_canonical_path (
@@ -416,7 +416,7 @@ TypeCheckItem::visit (HIR::Union &union_decl)
 
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
       canonical_path = nr_ctx.types.to_canonical_path (
@@ -591,7 +591,7 @@ TypeCheckItem::visit (HIR::Function &function)
   // FIXME: HACK: ARTHUR: Disgusting
   if (flag_name_resolution_2_0)
     {
-      auto nr_ctx
+      auto &nr_ctx
        = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
       auto canonical_path = nr_ctx.values.to_canonical_path (
        function.get_mappings ().get_nodeid ());
index 5f05deb4bc20d7d95ff19a46fb72a1e108a452e5..a48949021cac99ad0a536067826102cef09784c8 100644 (file)
@@ -270,7 +270,7 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset,
 
       if (flag_name_resolution_2_0)
        {
-         auto nr_ctx
+         auto &nr_ctx
            = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
 
          // assign the ref_node_id if we've found something
index e367c1b70ed8755118277a40f9a65f07aeffbaff..55c593494465dcd85f5049cdf88f035b7a30a329 100644 (file)
@@ -399,8 +399,8 @@ TypeCheckType::resolve_root_path (HIR::TypePath &path, size_t *offset,
          // FIXME: HACK: ARTHUR: Remove this
          if (flag_name_resolution_2_0)
            {
-             auto nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ()
-                             .resolver ();
+             auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ()
+                              .resolver ();
 
              // assign the ref_node_id if we've found something
              nr_ctx.lookup (path.get_mappings ().get_nodeid ())