diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-08-18 16:28:49 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-08-19 21:59:00 +0100 |
commit | fdbf789c2bb93baebd449744309d7c42bf2b36b8 (patch) | |
tree | cb4de70f42cb25876ff40cafa1ed7907b866eb25 /gcc/rust/backend/rust-compile.cc | |
parent | 4f039ff9f6f18d15e32ddb54e3a6124802c45b7f (diff) | |
download | gcc-fdbf789c2bb93baebd449744309d7c42bf2b36b8.zip gcc-fdbf789c2bb93baebd449744309d7c42bf2b36b8.tar.gz gcc-fdbf789c2bb93baebd449744309d7c42bf2b36b8.tar.bz2 |
Redo coercion site code
This gets rid of the old visitor method and brings us much closer to the
Rustc rules which from the algo mentioned in the comment's do the checks
in a very specific order which we need to match.
Diffstat (limited to 'gcc/rust/backend/rust-compile.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index c4100c4..bf34bb6 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -312,13 +312,6 @@ HIRCompileBase::coercion_site1 (tree rvalue, const TyTy::BaseType *rval, lvalue_locus, rvalue_locus)) return error_mark_node; } - else if (expected->get_kind () == TyTy::TypeKind::DYNAMIC - && actual->get_kind () != TyTy::TypeKind::DYNAMIC) - { - const TyTy::DynamicObjectType *dyn - = static_cast<const TyTy::DynamicObjectType *> (expected); - return coerce_to_dyn_object (rvalue, actual, expected, dyn, rvalue_locus); - } else if (expected->get_kind () == TyTy::TypeKind::SLICE) { // bad coercion @@ -333,7 +326,7 @@ HIRCompileBase::coercion_site1 (tree rvalue, const TyTy::BaseType *rval, // return an unsized coercion Resolver::Adjustment unsize_adj ( - Resolver::Adjustment::AdjustmentType::UNSIZE, expected); + Resolver::Adjustment::AdjustmentType::UNSIZE, actual, expected); return resolve_unsized_adjustment (unsize_adj, rvalue, rvalue_locus); } @@ -343,7 +336,6 @@ HIRCompileBase::coercion_site1 (tree rvalue, const TyTy::BaseType *rval, tree HIRCompileBase::coerce_to_dyn_object (tree compiled_ref, const TyTy::BaseType *actual, - const TyTy::BaseType *expected, const TyTy::DynamicObjectType *ty, Location locus) { |