]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix warnings from const auto& to const auto
authorbadumbatish <tanghocle456@gmail.com>
Sun, 4 Aug 2024 19:43:09 +0000 (12:43 -0700)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 19 Mar 2025 14:32:05 +0000 (15:32 +0100)
gcc/rust/ChangeLog:

* resolve/rust-ast-resolve.cc (NameResolution::go):
Fix warnings from const auto& to const auto

gcc/rust/resolve/rust-ast-resolve.cc

index a467d1e38b4cff1a1d5d8ce8d1887c5e72fdf855..a093ef7f444d44cead0161ae9c9465eb7bfd5262 100644 (file)
@@ -63,7 +63,10 @@ NameResolution::go (AST::Crate &crate)
 {
   // lookup current crate name
   CrateNum cnum = mappings.get_current_crate ();
-  const auto &crate_name = mappings.get_crate_name (cnum).value ();
+
+  // Clones the crate name instead of references due to gcc's possibly
+  // dangling references warnings
+  const auto crate_name = mappings.get_crate_name (cnum).value ();
 
   // setup the ribs
   NodeId scope_node_id = crate.get_node_id ();