]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: nr2.0: Remove accidental copies of resolver
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 21 Oct 2024 22:02:48 +0000 (18:02 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:00 +0000 (13:07 +0100)
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 29cc8835c33d186a0898e2a48f4d444abd482039..48713e7b8b4d981ebeba12f48942a51a4e61920c 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 52cd59f94e4f4e3b4730605143bd8db09b351d8c..39d4b9eb4fad39415455d9cbfb9fedf3d4b48c6d 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 103f0cb6fe86eb9596f2a00f4e58e177efaf8705..fbf9a3dab590039639756f107f15cf0084c538a0 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 6e2e2e4e4477b5df607ad778bc7b54174285e632..af7535a9826e16a69cd249a1a1f934cfcb1562ee 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 7fa4b43d187bfb18edf155494049ea9884e6d43c..c80a12f8f84e6cccb22757626a4c4a53d6f15217 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 937a8a8d0efc0a113bc0bb7f5f2dd7330b72c766..7d31d3653ce166dd85edf83f9514c3fbb5487da3 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 85ffb9fa5c7c83124be3366575a7f6ea67fd0d54..e1bf735bb866365603d7b3de34e9ed02cecc93ff 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 68b33d1a05d536bd71ef090c39fa7cbb47de0297..67718882ef0b194525ed9ff832c440063bde92c0 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 a7d28a671210c0a5e9021bce6103e188301a1b17..41fbdf336b73bac2e467520cf6baf9067d82a6f0 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 ())