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.h | |
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.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index bc14239..9b8976d 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -177,9 +177,9 @@ public: expr.get_rhs ()->get_mappings ().get_hirid (), &actual); rust_assert (ok); - rvalue - = coercion_site (rvalue, actual, expected, expr.get_lhs ()->get_locus (), - expr.get_rhs ()->get_locus ()); + rvalue = coercion_site (expr.get_mappings ().get_hirid (), rvalue, actual, + expected, expr.get_lhs ()->get_locus (), + expr.get_rhs ()->get_locus ()); tree assignment = ctx->get_backend ()->assignment_statement (lvalue, rvalue, @@ -435,8 +435,9 @@ public: if (ok) { - 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 @@ -469,7 +470,8 @@ public: // compile/torture/struct_base_init_1.rs if (ok) { - rvalue = coercion_site (rvalue, actual, expected, lvalue_locus, + rvalue = coercion_site (argument->get_mappings ().get_hirid (), + rvalue, actual, expected, lvalue_locus, rvalue_locus); } |