]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Handle structs as scrutinee for match expressions
authorNobel Singh <nobel2073@gmail.com>
Sun, 21 Apr 2024 18:41:12 +0000 (00:26 +0545)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:22 +0000 (16:35 +0100)
gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (check_match_scrutinee): Handle structs

Signed-off-by: Nobel Singh <nobel2073@gmail.com>
gcc/rust/backend/rust-compile-expr.cc

index 4d43a444221dab22b01880099a4be659a88bd2bd..ac85628d03c742599bb84274a364c4b08ff94540 100644 (file)
@@ -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<TyTy::ADTType *> (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)
     {