aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile.cc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-08-19 21:06:50 +0000
committerGitHub <noreply@github.com>2022-08-19 21:06:50 +0000
commit0f4ec11e8c2399ca20f80b4006e294794f9b2e0f (patch)
tree9631c8dd4a6aeaa85ed2248faae9af02ba370023 /gcc/rust/backend/rust-compile.cc
parentabfd358d756b409ce657761d320b04b9383cbfd8 (diff)
parentfdbf789c2bb93baebd449744309d7c42bf2b36b8 (diff)
downloadgcc-0f4ec11e8c2399ca20f80b4006e294794f9b2e0f.zip
gcc-0f4ec11e8c2399ca20f80b4006e294794f9b2e0f.tar.gz
gcc-0f4ec11e8c2399ca20f80b4006e294794f9b2e0f.tar.bz2
Merge #1492
1492: Redo coercion site code r=philberty a=philberty 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. Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile.cc')
-rw-r--r--gcc/rust/backend/rust-compile.cc10
1 files changed, 1 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index 6913144..0ccb98d 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -161,13 +161,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
@@ -182,7 +175,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);
}
@@ -192,7 +185,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)
{