From: Pierre-Emmanuel Patry <[email protected]>

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]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/4bad9e6144dd3fe867919aeb75a63e790f985087

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/5023

 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 388af2e61..22cb68850 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;
   }
 
-- 
2.56.0

Reply via email to