diff options
author | Nobel Singh <nobel2073@gmail.com> | 2024-04-22 00:26:12 +0545 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-17 16:35:22 +0100 |
commit | a929d6573468882a3e7217f5bd0ff65764e5a631 (patch) | |
tree | 06d66426e3b2f328b50ca5e5388aa9b10555ae66 /gcc | |
parent | 40b40970e648bd5f9a2edd2d8273544685176848 (diff) | |
download | gcc-a929d6573468882a3e7217f5bd0ff65764e5a631.zip gcc-a929d6573468882a3e7217f5bd0ff65764e5a631.tar.gz gcc-a929d6573468882a3e7217f5bd0ff65764e5a631.tar.bz2 |
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 <nobel2073@gmail.com>
Diffstat (limited to 'gcc')
-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 4d43a44..ac85628 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) { |