From: Arthur Cohen Date: Wed, 3 Jun 2026 09:22:27 +0000 (+0200) Subject: gccrs: nr: Disable flatten function for now X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6dcd03c3aa756703624bbc21884769f5302a0ca;p=thirdparty%2Fgcc.git 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 --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index a2a031ddd99..ada57d4d8f7 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -946,12 +946,15 @@ public: tl::expected 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 resolved_nodes; diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 9a21dc1ee1b..c652e37f684 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -766,6 +766,7 @@ ForeverStack::find_leaf_definition (const NodeId &key) const return find_leaf_definition_inner (Usage (key), resolved_nodes, keys_seen); } +#if 0 template void ForeverStack::flatten () @@ -793,6 +794,7 @@ ForeverStack::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 479d0cb4667..7bb74b7e520 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 f44fc2c5df5..779f6a725da 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)...); } + // 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 &stack, typename ForeverStack::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 resolved_nodes; }; } // namespace Resolver2_0