diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-08-03 13:14:54 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-08-04 16:52:52 +0100 |
commit | 5d17a8b6b2c086d4df516de06ddacdf88728f6ba (patch) | |
tree | f35b2207aeda6e2fa6fde7fa36f986d1f9667f3b /gcc/rust/backend/rust-compile-expr.cc | |
parent | 79d0f29464fc0aa68af7b317964aff4bc35af59a (diff) | |
download | gcc-5d17a8b6b2c086d4df516de06ddacdf88728f6ba.zip gcc-5d17a8b6b2c086d4df516de06ddacdf88728f6ba.tar.gz gcc-5d17a8b6b2c086d4df516de06ddacdf88728f6ba.tar.bz2 |
Support Autoderef coercions
This is an incremental approach to get our coercion sites more acurate to
rustc. This allows us to support coercions which require a deref by sharing
the code from the autoderef cycle. The eventual goal here will allow us to
remove the rust-tyty-coercion rules which is messy and cannot handle logic
such as DST's very well.
Fixes #1198
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 8576cf2..38d10d2 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -853,8 +853,9 @@ CompileExpr::visit (HIR::CallExpr &expr) Location lvalue_locus = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ()); Location rvalue_locus = argument->get_locus (); - rvalue = coercion_site (rvalue, actual, expected, lvalue_locus, - rvalue_locus); + rvalue + = coercion_site (argument->get_mappings ().get_hirid (), rvalue, + actual, expected, lvalue_locus, rvalue_locus); // add it to the list arguments.push_back (rvalue); @@ -951,8 +952,8 @@ CompileExpr::visit (HIR::CallExpr &expr) Location lvalue_locus = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ()); Location rvalue_locus = argument->get_locus (); - rvalue - = coercion_site (rvalue, actual, expected, lvalue_locus, rvalue_locus); + rvalue = coercion_site (argument->get_mappings ().get_hirid (), rvalue, + actual, expected, lvalue_locus, rvalue_locus); // add it to the list args.push_back (rvalue); @@ -1069,8 +1070,8 @@ CompileExpr::visit (HIR::MethodCallExpr &expr) Location lvalue_locus = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ()); Location rvalue_locus = argument->get_locus (); - rvalue - = coercion_site (rvalue, actual, expected, lvalue_locus, rvalue_locus); + rvalue = coercion_site (argument->get_mappings ().get_hirid (), rvalue, + actual, expected, lvalue_locus, rvalue_locus); // add it to the list args.push_back (rvalue); |