aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-stmt.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-08-03 13:14:54 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-04 16:52:52 +0100
commit5d17a8b6b2c086d4df516de06ddacdf88728f6ba (patch)
treef35b2207aeda6e2fa6fde7fa36f986d1f9667f3b /gcc/rust/backend/rust-compile-stmt.h
parent79d0f29464fc0aa68af7b317964aff4bc35af59a (diff)
downloadgcc-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-stmt.h')
-rw-r--r--gcc/rust/backend/rust-compile-stmt.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-stmt.h b/gcc/rust/backend/rust-compile-stmt.h
index aa17a4a..9bb4b7b 100644
--- a/gcc/rust/backend/rust-compile-stmt.h
+++ b/gcc/rust/backend/rust-compile-stmt.h
@@ -87,7 +87,8 @@ public:
Location lvalue_locus = stmt.get_pattern ()->get_locus ();
Location rvalue_locus = stmt.get_init_expr ()->get_locus ();
TyTy::BaseType *expected = ty;
- init = coercion_site (init, actual, expected, lvalue_locus, rvalue_locus);
+ init = coercion_site (stmt.get_mappings ().get_hirid (), init, actual,
+ expected, lvalue_locus, rvalue_locus);
auto fnctx = ctx->peek_fn ();
if (ty->is_unit ())