-
Notifications
You must be signed in to change notification settings - Fork 167
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 = ¤t_node->parent.value (); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Based on #3416