https://gcc.gnu.org/g:42b194aa24523b709249984d938a84a52d6208d2

commit r17-5928-g42b194aa24523b709249984d938a84a52d6208d2
Author: Pierre-Emmanuel Patry <[email protected]>
Date:   Tue Oct 27 00:34:11 2026 +0100

    gccrs: Fix forever stack path string representation
    
    The string representation used an opening scope even if the path did not
    reference the extern prelude.
    
    gcc/rust/ChangeLog:
    
            * resolve/rust-forever-stack.h: Only output an opening scope double
            semicolon when we use it.
    
    Signed-off-by: Pierre-Emmanuel Patry <[email protected]>

Diff:
---
 gcc/rust/resolve/rust-forever-stack.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/resolve/rust-forever-stack.h 
b/gcc/rust/resolve/rust-forever-stack.h
index 388af2e611fc..22cb6885094f 100644
--- a/gcc/rust/resolve/rust-forever-stack.h
+++ b/gcc/rust/resolve/rust-forever-stack.h
@@ -457,10 +457,17 @@ public:
   std::string as_string () const
   {
     std::string ret;
+    auto it = segments.cbegin ();
     if (lang_prefix)
-      ret = "#[lang]::";
-    for (auto &seg : segments)
-      ret += "::" + seg.name;
+      ret = "#[lang]";
+    else
+      {
+       ret += it->name;
+       it++;
+      }
+
+    for (; it != segments.cend (); it++)
+      ret += "::" + it->name;
     return ret;
   }

Reply via email to