From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 06F493AAA070; Wed, 8 Jun 2022 12:21:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06F493AAA070 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 #1040 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: 32894e6986523cb6b0d4225f820d80a725546c3a X-Git-Newrev: 6ecd43c7797eb287f15d64f80f4654361c046f4a Message-Id: <20220608122153.06F493AAA070@sourceware.org> Date: Wed, 8 Jun 2022 12:21:53 +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:21:53 -0000 https://gcc.gnu.org/g:6ecd43c7797eb287f15d64f80f4654361c046f4a commit 6ecd43c7797eb287f15d64f80f4654361c046f4a Merge: 32894e69865 a64a5cf77c9 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Tue Mar 22 11:02:45 2022 +0000 Merge #1040 1040: Do not propagate parse errors in match repetitions r=CohenArthur a=CohenArthur Since parsing repetitions is very eager, the parser might accumulate bogus errors by trying to match more repetitions than there are. We can avoid this by clearing the parsing errors if parsing repetitions returned a valid result. This should not be an issue for previous matchers erroring out, as they would immediately return upon failure and not reach inside other match functions. We need to figure out the best way to emit parser errors, as we do not always want to emit them in `match_fragment`. I think for now the easiest is to just *not* emit parse errors and simply error out with "failed to match macro rule". We will need to think about adding a bunch of hints too in order to make using macros easier. Fixes #958 Co-authored-by: Arthur Cohen Diff: gcc/rust/expand/rust-macro-expand.cc | 11 +++++++---- gcc/rust/parse/rust-parse.h | 3 ++- gcc/testsuite/rust/compile/macro25.rs | 9 +++++++++ gcc/testsuite/rust/compile/macro9.rs | 1 - 4 files changed, 18 insertions(+), 6 deletions(-)