aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-expr.h
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-11-08 16:34:19 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:13:13 +0100
commitea59190d54612f9f0e09c77a0601023ef43f861d (patch)
treed8e349d42ce39bd9df6f16b4313d6415bc674626 /gcc/rust/ast/rust-expr.h
parentb52651427be060094b2b1955d4425ddee73ef855 (diff)
downloadgcc-ea59190d54612f9f0e09c77a0601023ef43f861d.zip
gcc-ea59190d54612f9f0e09c77a0601023ef43f861d.tar.gz
gcc-ea59190d54612f9f0e09c77a0601023ef43f861d.tar.bz2
gccrs: Use a loop label in break expression
Break expression were using a raw lifetime value instead of a loop label this behavior would have lead to some errors in ast validation. gcc/rust/ChangeLog: * ast/rust-expr.h (class BreakExpr): Change Lifetime to LoopLabel. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Lower lifetime inside the label instead. * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Resolve the inner lifetime. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r--gcc/rust/ast/rust-expr.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index f0d663b..4dc240c 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -2727,7 +2727,7 @@ protected:
class BreakExpr : public ExprWithoutBlock
{
std::vector<Attribute> outer_attrs;
- Lifetime label;
+ LoopLabel label;
std::unique_ptr<Expr> break_expr;
location_t locus;
@@ -2745,7 +2745,7 @@ public:
bool has_break_expr () const { return break_expr != nullptr; }
// Constructor for a break expression
- BreakExpr (Lifetime break_label, std::unique_ptr<Expr> expr_in_break,
+ BreakExpr (LoopLabel break_label, std::unique_ptr<Expr> expr_in_break,
std::vector<Attribute> outer_attribs, location_t locus)
: outer_attrs (std::move (outer_attribs)), label (std::move (break_label)),
break_expr (std::move (expr_in_break)), locus (locus)
@@ -2807,7 +2807,7 @@ public:
outer_attrs = std::move (new_attrs);
}
- Lifetime &get_label () { return label; }
+ LoopLabel &get_label () { return label; }
protected:
/* Use covariance to implement clone function as returning this object rather