[gcc/devel/rust/master] backend: Allow anything as a match scrutinee
Thomas Schwinge
tschwinge@gcc.gnu.org
Wed Mar 26 14:07:53 GMT 2025
https://gcc.gnu.org/g:3638b0551e48f7a9b292409f750174727ea7a5e2
commit 3638b0551e48f7a9b292409f750174727ea7a5e2
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date: Tue Dec 24 11:45:09 2024 +0000
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:
---
gcc/rust/backend/rust-compile-expr.cc | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index c24a22a3118f..1d68e85aa769 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)
{
More information about the Gcc-cvs
mailing list