Skip to content

Commit 97ca260

Browse files
powerboat9CohenArthur
authored andcommitted
nr2.0: Adjust alternate identifier handling
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (visit_identifier_as_pattern): Make sure to map identifiers inside or-bindings to prior identifiers. Signed-off-by: Owen Avery <[email protected]>
1 parent 0dbcc83 commit 97ca260

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gcc/rust/resolve/rust-late-name-resolver-2.0.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ visit_identifier_as_pattern (NameResolutionContext &ctx,
236236

237237
if (ctx.bindings.peek ().is_or_bound (ident))
238238
{
239-
// FIXME: map usage instead
240-
std::ignore = ctx.values.insert_shadowable (ident, node_id);
239+
auto res = ctx.values.get (ident);
240+
rust_assert (res.has_value () && !res->is_ambiguous ());
241+
ctx.map_usage (Usage (node_id), Definition (res->get_node_id ()));
241242
}
242243
else
243244
{

0 commit comments

Comments
 (0)