From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id B0C0E38887A5; Wed, 8 Jun 2022 12:33:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0C0E38887A5 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Merge #1138 X-Act-Checkin: gcc X-Git-Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: dc57f4ced0d168be911ca22db81fe9526e2d70a8 X-Git-Newrev: 14dbac9a8bbc7f3cf37679e91ea56e449a64bde7 Message-Id: <20220608123328.B0C0E38887A5@sourceware.org> Date: Wed, 8 Jun 2022 12:33:28 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 12:33:28 -0000 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 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(-)