From: Arthur Cohen Date: Wed, 9 Apr 2025 12:44:56 +0000 (+0200) Subject: gccrs: ast: Support outer attributes for AST::RangeExpr X-Git-Tag: basepoints/gcc-16~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09c4a7a58b4dd6a95b72224d83c715308da9838a;p=thirdparty%2Fgcc.git gccrs: 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. --- diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 84cdfdb4678..69538df63e5 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 empty_attributes = {}; + protected: // outer attributes not allowed before range expressions RangeExpr (location_t locus) : locus (locus) {} @@ -3013,15 +3017,11 @@ public: std::vector &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 /* new_attrs */) override - { - rust_assert (false); - } + void set_outer_attrs (std::vector /* new_attrs */) override {} Expr::Kind get_expr_kind () const override { return Expr::Kind::Range; } };