Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nr2.0: Run DefaultResolver::visit on PathInExpression #3418

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

powerboat9
Copy link
Collaborator

Based on #3416

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that specific commit looks good so that PR is good to me, but I want to spend some time reviewing the one it's based on

gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx
	(ForeverStack::find_starting_point): Be more careful about
	applying ForeverStack::find_closest_module.
	(ForeverStack::resolve_segments): Allow traversal into parent
	nodes when not in a module node or root node, which
	ForeverStack::find_starting_point previously made moot through
	use of ForeverStack::find_closest_module. Also, when a child
	node lookup fails when resolving in the type namespace, attempt
	a rib lookup as a fallback.
	* resolve/rust-late-name-resolver-2.0.cc
	(Late::visit): Avoid throwing a resolution error for type paths
	when the typechecker may be able to finish the resolution. Also,
	throw an error when a resolution is ambiguous.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc
	(Late::visit): When visiting a PathInExpression instance, call
	into DefaultResolver::visit, ensuring generic arguments are
	visited.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <[email protected]>
@@ -469,27 +464,48 @@ ForeverStack<N>::resolve_segments (

tl::optional<typename ForeverStack<N>::Node &> child = tl::nullopt;

for (auto &kv : current_node->children)
while (true)
Copy link
Member

@philberty philberty Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes these are unavoidable but definitely double check to ensure this will terminate you could add a comment to say why this is fine and does terminate might be enough

return tl::nullopt;
}

current_node = &current_node->parent.value ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the current_node.has_value () might be worth being part of the loop predicate but tbh i dont know this code enough to make you change anything here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The for loop may set the value of child

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants