Skip to content

Commit

Permalink
Improve handling of ConstantItem during name resolution 2.0
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* resolve/rust-default-resolver.cc
	(DefaultResolver::visit):
	Scope with Rib::Kind::ConstantItem instead
	of Rib::Kind::Item.
	* resolve/rust-toplevel-name-resolver-2.0.cc
	(TopLevel::visit): Remove redundancy in override of
	ConstantItem visitor.

Signed-off-by: Owen Avery <[email protected]>
  • Loading branch information
powerboat9 authored and P-E-P committed Jun 6, 2024
1 parent 6460460 commit 75049a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gcc/rust/resolve/rust-default-resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ DefaultResolver::visit (AST::ConstantItem &item)
};

// FIXME: Why do we need a Rib here?
ctx.scoped (Rib::Kind::Item, item.get_node_id (), expr_vis);
ctx.scoped (Rib::Kind::ConstantItem, item.get_node_id (), expr_vis);
}
}

Expand Down
5 changes: 1 addition & 4 deletions gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,7 @@ TopLevel::visit (AST::ConstantItem &const_item)
insert_or_error_out (const_item.get_identifier (), const_item,
Namespace::Values);

auto expr_vis
= [this, &const_item] () { const_item.get_expr ().accept_vis (*this); };

ctx.scoped (Rib::Kind::ConstantItem, const_item.get_node_id (), expr_vis);
DefaultResolver::visit (const_item);
}

bool
Expand Down

0 comments on commit 75049a3

Please sign in to comment.