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

commit r17-1879-gb6dcd03c3aa756703624bbc21884769f5302a0ca
Author: Arthur Cohen <[email protected]>
Date:   Wed Jun 3 11:22:27 2026 +0200

    gccrs: nr: Disable flatten function for now
    
    gcc/rust/ChangeLog:
    
            * resolve/rust-forever-stack.h: Comment out flatten with an 
explanation.
            * resolve/rust-forever-stack.hxx: Likewise.
            * resolve/rust-name-resolution-context.cc 
(NameResolutionContext::flatten): Likewise.
            * resolve/rust-name-resolution-context.h: Likewise.

Diff:
---
 gcc/rust/resolve/rust-forever-stack.h            | 3 +++
 gcc/rust/resolve/rust-forever-stack.hxx          | 2 ++
 gcc/rust/resolve/rust-name-resolution-context.cc | 2 ++
 gcc/rust/resolve/rust-name-resolution-context.h  | 7 ++++---
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/resolve/rust-forever-stack.h 
b/gcc/rust/resolve/rust-forever-stack.h
index a2a031ddd998..ada57d4d8f7c 100644
--- a/gcc/rust/resolve/rust-forever-stack.h
+++ b/gcc/rust/resolve/rust-forever-stack.h
@@ -946,12 +946,15 @@ public:
   tl::expected<Definition, LookupFinalizeError>
   find_leaf_definition (const NodeId &key) const;
 
+  // Flattening is not needed for now but should be used later?
+#if 0
   /**
    * Look at NameResolutionContext::flatten - This is the inner working 
function
    * which works on one specific namespace, while 
NameResolutionContext::flatten
    * calls flatten for every namespace
    */
   void flatten ();
+#endif
 
   /* Map of "usage" nodes which have been resolved to a "definition" node */
   std::map<Usage, Definition> resolved_nodes;
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx 
b/gcc/rust/resolve/rust-forever-stack.hxx
index 9a21dc1ee1b1..c652e37f684b 100644
--- a/gcc/rust/resolve/rust-forever-stack.hxx
+++ b/gcc/rust/resolve/rust-forever-stack.hxx
@@ -766,6 +766,7 @@ ForeverStack<N>::find_leaf_definition (const NodeId &key) 
const
   return find_leaf_definition_inner (Usage (key), resolved_nodes, keys_seen);
 }
 
+#if 0
 template <Namespace N>
 void
 ForeverStack<N>::flatten ()
@@ -793,6 +794,7 @@ ForeverStack<N>::flatten ()
       k_v.second = result.value ();
     }
 }
+#endif
 
 // FIXME: Can we add selftests?
 
diff --git a/gcc/rust/resolve/rust-name-resolution-context.cc 
b/gcc/rust/resolve/rust-name-resolution-context.cc
index 479d0cb46670..7bb74b7e5208 100644
--- a/gcc/rust/resolve/rust-name-resolution-context.cc
+++ b/gcc/rust/resolve/rust-name-resolution-context.cc
@@ -372,6 +372,7 @@ NameResolutionContext::scoped (Rib::Kind rib_kind, 
Namespace ns,
     }
 }
 
+#if 0
 void
 NameResolutionContext::flatten ()
 {
@@ -380,6 +381,7 @@ NameResolutionContext::flatten ()
   macros.flatten ();
   labels.flatten ();
 }
+#endif
 
 } // namespace Resolver2_0
 } // namespace Rust
diff --git a/gcc/rust/resolve/rust-name-resolution-context.h 
b/gcc/rust/resolve/rust-name-resolution-context.h
index f44fc2c5df54..779f6a725da8 100644
--- a/gcc/rust/resolve/rust-name-resolution-context.h
+++ b/gcc/rust/resolve/rust-name-resolution-context.h
@@ -842,6 +842,9 @@ public:
                         std::forward<Args> (args)...);
   }
 
+  // We disable this function for now as it causes regressions, but I think it
+  // is important for a more proper final nameres context - need to investigate
+#if 0
   /**
    * We've now collected every definition and import, and errored out when
    * necessary if multiple definitions are colliding. Do a final flattening of
@@ -860,6 +863,7 @@ public:
    * void function, yipee.
    */
   void flatten ();
+#endif
 
   /* If declared with #[prelude_import], the current standard library module
    */
@@ -913,9 +917,6 @@ private:
   resolve_final_segment (ForeverStack<N> &stack,
                         typename ForeverStack<N>::Node &final_node,
                         std::string &seg_name, bool is_lower_self);
-
-  /* Map of "usage" nodes which have been resolved to a "definition" node */
-  // std::map<Usage, Definition> resolved_nodes;
 };
 
 } // namespace Resolver2_0

Reply via email to