From: Nobel Singh Date: Sun, 21 Apr 2024 18:41:12 +0000 (+0545) Subject: gccrs: Handle structs as scrutinee for match expressions X-Git-Tag: basepoints/gcc-16~1450 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a929d6573468882a3e7217f5bd0ff65764e5a631;p=thirdparty%2Fgcc.git gccrs: Handle structs as scrutinee for match expressions gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_scrutinee): Handle structs Signed-off-by: Nobel Singh --- diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 4d43a444221..ac85628d03c 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -954,8 +954,8 @@ check_match_scrutinee (HIR::MatchExpr &expr, Context *ctx) // this will need to change but for now the first pass implementation, // lets assert this is the case TyTy::ADTType *adt = static_cast (scrutinee_expr_tyty); - rust_assert (adt->is_enum ()); - rust_assert (adt->number_of_variants () > 0); + if (adt->is_enum ()) + rust_assert (adt->number_of_variants () > 0); } else if (scrutinee_kind == TyTy::TypeKind::FLOAT) {