diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-05-09 15:59:46 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-05-09 16:22:28 +0000 |
commit | 875cd5ee9c6f037c7f5ace00b75631a1c45970a5 (patch) | |
tree | fd09080649efb48c850c2725c5493ae71ea27d38 /gcc/rust/backend/rust-compile-context.h | |
parent | eb60cd1f6d53136467857c30140c7ef282c39085 (diff) | |
download | gcc-875cd5ee9c6f037c7f5ace00b75631a1c45970a5.zip gcc-875cd5ee9c6f037c7f5ace00b75631a1c45970a5.tar.gz gcc-875cd5ee9c6f037c7f5ace00b75631a1c45970a5.tar.bz2 |
gccrs: Add missing coercion site logic to return expressions
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: track return type in fncontext
* backend/rust-compile-context.h (struct fncontext): likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): apply coercion site
(CompileExpr::generate_closure_function): update push_context
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
gcc/testsuite/ChangeLog:
* rust/execute/torture/coercion3.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index 8e8fac8..513f81d 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -35,6 +35,7 @@ struct fncontext { tree fndecl; ::Bvariable *ret_addr; + TyTy::BaseType *retty; }; class Context @@ -267,9 +268,9 @@ public: return true; } - void push_fn (tree fn, ::Bvariable *ret_addr) + void push_fn (tree fn, ::Bvariable *ret_addr, TyTy::BaseType *retty) { - fn_stack.push_back (fncontext{fn, ret_addr}); + fn_stack.push_back (fncontext{fn, ret_addr, retty}); } void pop_fn () { fn_stack.pop_back (); } |