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

Resolve lang-item PathInExpressions in nr2.0 late resolver #3404

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gcc/rust/resolve/rust-late-name-resolver-2.0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,14 @@ Late::visit (AST::PathInExpression &expr)
// TODO: How do we have a nice error with `can't capture dynamic environment
// in a function item` error here?
// do we emit it in `get<Namespace::Labels>`?

if (expr.is_lang_item ())
return;
{
ctx.map_usage (Usage (expr.get_node_id ()),
Definition (Analysis::Mappings::get ().get_lang_item_node (
expr.get_lang_item ())));
return;
}

auto resolved
= ctx.values.resolve_path (expr.get_segments ()).or_else ([&] () {
Copy link
Contributor

Choose a reason for hiding this comment

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

When I was looking at this code, I got lost trying to figure out what resolve_path does, and how forever stacks work, and missed that the important part was calling map_usage.

Copy link
Member Author

Choose a reason for hiding this comment

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

no worries it's all good :) dealing with the macro expansion is already complex enough for one PR haha

Expand Down