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-stmt.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-stmt.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-stmt.h | 3 |
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 ()) |