From e2126a193567e97e57c854ef59952c6df3063bbf Mon Sep 17 00:00:00 2001 From: badumbatish Date: Sun, 4 Aug 2024 12:43:09 -0700 Subject: gccrs: Fix warnings from const auto& to const auto 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc index a467d1e..a093ef7 100644 --- a/gcc/rust/resolve/rust-ast-resolve.cc +++ b/gcc/rust/resolve/rust-ast-resolve.cc @@ -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 (); -- cgit v1.1