Skip to content

Commit

Permalink
nr2.0: late: Add proper handling for lang item PathInExpressions
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Special case lang item paths.
  • Loading branch information
CohenArthur committed Feb 2, 2025
1 parent af2fdca commit adf6afb
Showing 1 changed file with 7 additions and 1 deletion.
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 ([&] () {
Expand Down

0 comments on commit adf6afb

Please sign in to comment.