From: Arthur Cohen Date: Tue, 24 Dec 2024 11:45:09 +0000 (+0000) Subject: gccrs: backend: Allow anything as a match scrutinee X-Git-Tag: basepoints/gcc-16~819 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=561ef90a3649a12a82b2312d0559d6f4de0a4db8;p=thirdparty%2Fgcc.git gccrs: backend: Allow anything as a match scrutinee gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (check_match_scrutinee): Allow anything to be used as a match scrutinee, not just ADTs. --- diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 353a498dc4e..887e476f234 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -31,6 +31,7 @@ #include "convert.h" #include "print-tree.h" #include "rust-system.h" +#include "rust-tyty.h" namespace Rust { namespace Compile { @@ -1035,11 +1036,6 @@ check_match_scrutinee (HIR::MatchExpr &expr, Context *ctx) } TyTy::TypeKind scrutinee_kind = scrutinee_expr_tyty->get_kind (); - rust_assert ((TyTy::is_primitive_type_kind (scrutinee_kind) - && scrutinee_kind != TyTy::TypeKind::NEVER) - || scrutinee_kind == TyTy::TypeKind::ADT - || scrutinee_kind == TyTy::TypeKind::TUPLE - || scrutinee_kind == TyTy::TypeKind::REF); if (scrutinee_kind == TyTy::TypeKind::FLOAT) {