Skip to content

Commit baa4c42

Browse files
powerboat9P-E-P
authored andcommitted
nr2.0: Fix resolution of constant items
gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Call DefaultASTVisitor::visit even on ConstantItem instances without expressions. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove issue-3642.rs. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
1 parent a968963 commit baa4c42

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

gcc/rust/resolve/rust-default-resolver.cc

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -361,19 +361,15 @@ DefaultResolver::visit (AST::MatchExpr &expr)
361361
void
362362
DefaultResolver::visit (AST::ConstantItem &item)
363363
{
364-
if (item.has_expr ())
365-
{
366-
auto expr_vis_1
367-
= [this, &item] () { AST::DefaultASTVisitor::visit (item); };
368-
369-
auto expr_vis_2 = [this, &item, &expr_vis_1] () {
370-
ctx.canonical_ctx.scope (item.get_node_id (), item.get_identifier (),
371-
std::move (expr_vis_1));
372-
};
373-
374-
// FIXME: Why do we need a Rib here?
375-
ctx.scoped (Rib::Kind::ConstantItem, item.get_node_id (), expr_vis_2);
376-
}
364+
auto expr_vis_1 = [this, &item] () { AST::DefaultASTVisitor::visit (item); };
365+
366+
auto expr_vis_2 = [this, &item, &expr_vis_1] () {
367+
ctx.canonical_ctx.scope (item.get_node_id (), item.get_identifier (),
368+
std::move (expr_vis_1));
369+
};
370+
371+
// FIXME: Why do we need a Rib here?
372+
ctx.scoped (Rib::Kind::ConstantItem, item.get_node_id (), expr_vis_2);
377373
}
378374

379375
void
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
issue-3315-2.rs
22
torture/alt_patterns1.rs
3-
issue-3642.rs
43
# please don't delete the trailing newline

0 commit comments

Comments
 (0)