diff options
author | Nobel Singh <nobel2073@gmail.com> | 2024-04-22 00:26:12 +0545 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-05-15 13:54:29 +0000 |
commit | 9e45b86996ebff8bc9ac99170a2d0e1374c8fd7f (patch) | |
tree | 31f06934882f6e6787e1b83c3ff4c44eb7352683 /gcc/rust/backend/rust-compile-expr.cc | |
parent | add0e45fc9e8a40eec81232fdc1decd90dd35aeb (diff) | |
download | gcc-9e45b86996ebff8bc9ac99170a2d0e1374c8fd7f.zip gcc-9e45b86996ebff8bc9ac99170a2d0e1374c8fd7f.tar.gz gcc-9e45b86996ebff8bc9ac99170a2d0e1374c8fd7f.tar.bz2 |
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 <nobel2073@gmail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 4d79501..6f37dd8 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<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) { |