Skip to content

Commit

Permalink
Fix type confusion in coercion
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jdupak authored and CohenArthur committed Oct 3, 2023
1 parent 2897221 commit 1908504
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gcc/rust/backend/rust-compile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<const TyTy::ReferenceType *> (expected);
const TyTy::PointerType *exp
= static_cast<const TyTy::PointerType *> (expected);

TyTy::BaseType *actual_base = nullptr;
if (actual->get_kind () == TyTy::TypeKind::REF)
Expand Down

0 comments on commit 1908504

Please sign in to comment.