From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id A261A3895FCF; Wed, 8 Jun 2022 12:45:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A261A3895FCF 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 #1222 #1223 #1225 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: 3b8f3e61394f27100fb788a839e61f8b753f502b X-Git-Newrev: dd5a7654d32134d9bfbe25180dad114367e77767 Message-Id: <20220608124504.A261A3895FCF@sourceware.org> Date: Wed, 8 Jun 2022 12:45:04 +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:45:04 -0000 https://gcc.gnu.org/g:dd5a7654d32134d9bfbe25180dad114367e77767 commit dd5a7654d32134d9bfbe25180dad114367e77767 Merge: 3b8f3e61394 55346cc59b7 cb4d935508d 16da547c6de Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Mon May 9 10:40:43 2022 +0000 Merge #1222 #1223 #1225 1222: Destructure our generics, placeholers or projections during coercion r=philberty a=philberty When we coerce types we need to destructure from the generics in order to apply these coercion rules correctly or we end up returning a bad error_mark_node. This was found while fixing https://github.com/Rust-GCC/gccrs/pull/1220 1223: Add new monomorphize_clone interface r=philberty a=philberty This interface is required when we monomorphize since types might be placeholder -> projection -> param -> actual-type This gives us a clean clone interface to destructure this into its actual type. This is important so for example if we have a generic trait function and resolve the function for a specific set of generics we update the associated types. This works, then when we go to substitute the same generic trait again the placeholders are again updated throwing off the typing for the first type. There is more cleanup we can do once this PR is in to make this part of the general monomorphization path so that we sort out these as part of the fntype Fixes #1133 1225: macros: Error out when repeating metavars which refer to repetitions r=CohenArthur a=CohenArthur In the case were a repeting metavar was used as a regular metavar ($var instead of $($var)* for example), the compiler would crash on an assertion that $var was only repeating once. We should instead error out and point to the user that this is probably not what they intended to do. Some spurious errors are emitted, but improving them requires a major refactor of the SubstitutionContext file to report error states before. Closes #1224 Thanks to `@bjorn3` for pointing this out. Co-authored-by: Philip Herron Co-authored-by: CohenArthur Diff: gcc/rust/backend/rust-compile-base.h | 4 +- gcc/rust/backend/rust-compile.cc | 25 ++- gcc/rust/expand/rust-macro-substitute-ctx.cc | 15 ++ gcc/rust/typecheck/rust-hir-type-check-expr.cc | 3 +- gcc/rust/typecheck/rust-tyty.cc | 267 ++++++++++++++++++++++- gcc/rust/typecheck/rust-tyty.h | 48 ++++ gcc/testsuite/rust/compile/macro-issue1224.rs | 9 + gcc/testsuite/rust/execute/torture/issue-1133.rs | 146 +++++++++++++ 8 files changed, 496 insertions(+), 21 deletions(-)