From: Arthur Cohen <[email protected]>
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.
---
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/97c795921cb9a9c0fa2fbe32352aa2477055b8a3
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/4551
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 a2a031ddd..ada57d4d8 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 9a21dc1ee..c652e37f6 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 479d0cb46..7bb74b7e5 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 f44fc2c5d..779f6a725 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
--
2.54.0