]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove unused variable assignments
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thu, 21 Aug 2025 11:15:39 +0000 (13:15 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 19:58:42 +0000 (20:58 +0100)
Multiple local variables were not read beyond their assignments.

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove
unused assignment.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments):
Likewise.
* typecheck/rust-tyty.cc (ParamType::handle_substitions): Likewise.
* typecheck/rust-unify.cc (UnifyRules::go): Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/rust/typecheck/rust-hir-type-check-path.cc
gcc/rust/typecheck/rust-tyty.cc
gcc/rust/typecheck/rust-unify.cc

index 33653f5a6512235940082ee1db9cd46ffeb2a7d9..9a772cba4c605d58f5f7a4316b9e8c483ce3be12 100644 (file)
@@ -629,10 +629,9 @@ TypeCheckExpr::visit (HIR::BlockExpr &expr)
       if (s->is_unit_check_needed () && !resolved->is_unit ())
        {
          auto unit = TyTy::TupleType::get_unit_type ();
-         resolved
-           = unify_site (s->get_mappings ().get_hirid (),
-                         TyTy::TyWithLocation (unit),
-                         TyTy::TyWithLocation (resolved), s->get_locus ());
+         unify_site (s->get_mappings ().get_hirid (),
+                     TyTy::TyWithLocation (unit),
+                     TyTy::TyWithLocation (resolved), s->get_locus ());
        }
     }
 
index 3068f0c6e3573c452d6a1d7f4b7e901fb9bd7da0..ffa099098c68b22abbf69dbab0ce1144a4aff1ae 100644 (file)
@@ -517,9 +517,8 @@ TypeCheckExpr::resolve_segments (NodeId root_resolved_node_id,
              const auto &predicate
                = impl_block_ty->lookup_predicate (trait_ref.get_defid ());
              if (!predicate.is_error ())
-               impl_block_ty
-                 = associated->setup_associated_types (prev_segment, predicate,
-                                                       nullptr, false);
+               associated->setup_associated_types (prev_segment, predicate,
+                                                   nullptr, false);
            }
        }
 
index 95e9bc2c17f76b514b4da04b3b56984f1acda81a..5e321f248c3731c1e65709109c75a4077f8b56d3 100644 (file)
@@ -3566,7 +3566,7 @@ ParamType::handle_substitions (SubstitutionArgumentMappings &subst_mappings)
     {
       const ParamType &pp = *static_cast<const ParamType *> (resolved);
       if (pp.can_resolve ())
-       resolved = pp.resolve ();
+       pp.resolve ();
     }
 
   // this is the new subst that this needs to pass
index 66ced65ad78087b89fd0ef5e04e0bf6fa13a0a6f..852451aeef4c1a3d527a90eaf3af44324bc873ac 100644 (file)
@@ -155,11 +155,8 @@ UnifyRules::emit_abi_mismatch (const TyTy::FnType &expected,
 TyTy::BaseType *
 UnifyRules::go ()
 {
-  TyTy::BaseType *ltype = lhs.get_ty ();
-  TyTy::BaseType *rtype = rhs.get_ty ();
-
-  ltype = lhs.get_ty ()->destructure ();
-  rtype = rhs.get_ty ()->destructure ();
+  TyTy::BaseType *ltype = lhs.get_ty ()->destructure ();
+  TyTy::BaseType *rtype = rhs.get_ty ()->destructure ();
 
   rust_debug ("unify::go ltype={%s} rtype={%s}", ltype->debug_str ().c_str (),
              rtype->debug_str ().c_str ());