Skip to content

Commit 7454729

Browse files
committed
Properly expand macro in ErrorPropagationExpr
gcc/rust/ChangeLog: * ast/rust-expr.h (ErrorPropagationExpr::get_propagating_expr_ptr): New member function. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Call maybe_expand_expr on the inner expression owned by an ErrorPropagationExpr. Signed-off-by: Owen Avery <[email protected]>
1 parent 85ec714 commit 7454729

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

gcc/rust/ast/rust-expr.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ class ErrorPropagationExpr : public OperatorExpr
488488
return *main_or_left_expr;
489489
}
490490

491+
std::unique_ptr<Expr> &get_propagating_expr_ptr ()
492+
{
493+
rust_assert (main_or_left_expr != nullptr);
494+
return main_or_left_expr;
495+
}
496+
491497
Expr::Kind get_expr_kind () const override
492498
{
493499
return Expr::Kind::ErrorPropagation;

gcc/rust/expand/rust-expand-visitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ ExpandVisitor::visit (AST::MetaItemPathExpr &)
544544
void
545545
ExpandVisitor::visit (AST::ErrorPropagationExpr &expr)
546546
{
547-
visit (expr.get_propagating_expr ());
547+
maybe_expand_expr (expr.get_propagating_expr_ptr ());
548548
}
549549

550550
void

0 commit comments

Comments
 (0)