public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #1138
@ 2022-06-08 12:33 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:33 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:14dbac9a8bbc7f3cf37679e91ea56e449a64bde7
commit 14dbac9a8bbc7f3cf37679e91ea56e449a64bde7
Merge: dc57f4ced0d c3a3e1053f4
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date: Wed Apr 20 08:33:46 2022 +0000
Merge #1138
1138: Support pattern bindings within function signitures r=philberty a=philberty
This reuses our code to handle match-arms within MatchExpressions, we
resolve the pattern's type's and implicitly create types for that binding.
For code-generation we create a tmp var name for the name of the parameter
which is the base type and for the destructuring we reuse the same match
arm code to generate the implicit bindings to the parts of the structure
```c
__attribute__((cdecl))
i32 test::pattern_as_arg (const struct test::Pattern RSTPRM.0)
{
i32 RUSTTMP.1;
return RSTPRM.0.0;
}
```
Fixes #995
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diff:
gcc/rust/Make-lang.in | 1 +
gcc/rust/backend/rust-compile-fnparam.cc | 62 ++++++++++++
gcc/rust/backend/rust-compile-fnparam.h | 5 +-
gcc/rust/backend/rust-compile-pattern.cc | 111 ++++++++++++++--------
gcc/rust/backend/rust-compile-pattern.h | 2 +-
gcc/rust/typecheck/rust-hir-type-check-implitem.h | 4 +
gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 40 ++++----
gcc/rust/typecheck/rust-hir-type-check-stmt.h | 1 +
gcc/rust/typecheck/rust-hir-type-check-toplevel.h | 1 +
gcc/rust/typecheck/rust-hir-type-check.cc | 1 +
gcc/testsuite/rust/execute/torture/issue-995.rs | 9 ++
11 files changed, 177 insertions(+), 60 deletions(-)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:33 [gcc/devel/rust/master] Merge #1138 Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).