https://gcc.gnu.org/g:fedeaeec739468b22c408e9de6a23ebd174a302a

commit r16-4804-gfedeaeec739468b22c408e9de6a23ebd174a302a
Author: Pierre-Emmanuel Patry <[email protected]>
Date:   Thu Aug 21 12:47:05 2025 +0200

    gccrs: Remove unused copy
    
    Variable path was copying the path but not using one of the copies.
    
    gcc/rust/ChangeLog:
    
            * resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): Remove
            unused copy.
    
    Signed-off-by: Pierre-Emmanuel Patry <[email protected]>

Diff:
---
 gcc/rust/resolve/rust-ast-resolve-stmt.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/resolve/rust-ast-resolve-stmt.cc 
b/gcc/rust/resolve/rust-ast-resolve-stmt.cc
index bfba302d29d1..2438cc48af42 100644
--- a/gcc/rust/resolve/rust-ast-resolve-stmt.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-stmt.cc
@@ -61,12 +61,11 @@ ResolveStmt::visit (AST::StaticItem &var)
 {
   auto decl = CanonicalPath::new_seg (var.get_node_id (),
                                      var.get_identifier ().as_string ());
-  auto path = decl;
   auto cpath = canonical_prefix.append (decl);
   mappings.insert_canonical_path (var.get_node_id (), cpath);
 
   resolver->get_name_scope ().insert (
-    path, var.get_node_id (), var.get_locus (), false, Rib::ItemType::Static,
+    decl, var.get_node_id (), var.get_locus (), false, Rib::ItemType::Static,
     [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
       rich_location r (line_table, var.get_locus ());
       r.add_range (locus);
@@ -74,7 +73,7 @@ ResolveStmt::visit (AST::StaticItem &var)
     });
 
   ResolveType::go (var.get_type ());
-  ResolveExpr::go (var.get_expr (), path, cpath);
+  ResolveExpr::go (var.get_expr (), decl, cpath);
 }
 
 } // namespace Resolver

Reply via email to