]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backend: Allow anything as a match scrutinee
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 24 Dec 2024 11:45:09 +0000 (11:45 +0000)
committerPhilip Herron <philip.herron@embecosm.com>
Thu, 23 Jan 2025 13:19:27 +0000 (13:19 +0000)
gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (check_match_scrutinee): Allow anything to be used as a
match scrutinee, not just ADTs.

gcc/rust/backend/rust-compile-expr.cc

index c24a22a3118fb6f10c985b20faf168837c63b751..1d68e85aa769f4b8e9d999cebeac64767e3c8774 100644 (file)
@@ -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)
     {