From 1908504f62d75e1084923c4e1ace6c3784299344 Mon Sep 17 00:00:00 2001 From: Jakub Dupak Date: Mon, 2 Oct 2023 21:54:16 +0200 Subject: [PATCH] Fix type confusion in coercion There was a mismatch between a manual discriminant test and the static cast. gcc/rust/ChangeLog: * backend/rust-compile.cc (HIRCompileBase::coercion_site1): Fix wrong cast Signed-off-by: Jakub Dupak --- gcc/rust/backend/rust-compile.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 27991994b844..404b90aa01ac 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -115,8 +115,8 @@ HIRCompileBase::coercion_site1 (tree rvalue, TyTy::BaseType *rval, if (!valid_coercion) return error_mark_node; - const TyTy::ReferenceType *exp - = static_cast (expected); + const TyTy::PointerType *exp + = static_cast (expected); TyTy::BaseType *actual_base = nullptr; if (actual->get_kind () == TyTy::TypeKind::REF)