aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2025-04-09 14:44:56 +0200
committerCohenArthur <arthur.cohen@embecosm.com>2025-04-14 08:03:49 +0000
commit4d09dd4abab3b0f4b9ceeaf434001ae2b41eb7e0 (patch)
treeda51e111ff800a850c90df8b46f40c4094b38712
parentfd6257bc2894124c328757ff08221580f6ea105b (diff)
downloadgcc-4d09dd4abab3b0f4b9ceeaf434001ae2b41eb7e0.zip
gcc-4d09dd4abab3b0f4b9ceeaf434001ae2b41eb7e0.tar.gz
gcc-4d09dd4abab3b0f4b9ceeaf434001ae2b41eb7e0.tar.bz2
ast: Support outer attributes for AST::RangeExpr
gcc/rust/ChangeLog: * ast/rust-expr.h (class RangeExpr): Add empty outer attributes and allow getting them and setting them.
-rw-r--r--gcc/rust/ast/rust-expr.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 84cdfdb..69538df 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -3004,6 +3004,10 @@ class RangeExpr : public ExprWithoutBlock
{
location_t locus;
+ // Some visitors still check for attributes on RangeExprs, and they will need
+ // to be supported in the future - so keep that for now
+ std::vector<Attribute> empty_attributes = {};
+
protected:
// outer attributes not allowed before range expressions
RangeExpr (location_t locus) : locus (locus) {}
@@ -3013,15 +3017,11 @@ public:
std::vector<Attribute> &get_outer_attrs () override final
{
- // RangeExpr cannot have any outer attributes
- rust_assert (false);
+ return empty_attributes;
}
// should never be called - error if called
- void set_outer_attrs (std::vector<Attribute> /* new_attrs */) override
- {
- rust_assert (false);
- }
+ void set_outer_attrs (std::vector<Attribute> /* new_attrs */) override {}
Expr::Kind get_expr_kind () const override { return Expr::Kind::Range; }
};