From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 955C33851ABC; Wed, 31 Aug 2022 14:10:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 955C33851ABC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661955015; bh=PqBbWQjoTPb40couCT05SGXNF+kkmrk+Wtb0LCx5naI=; h=From:To:Subject:Date:From; b=A0Zkl3URwvjSEXI+4ZryBappcjXuHFjDQPWV3QQAIMLAue0mmyGA8uFPFaI++kEAW 9Zx9A9pFJkMJPRluxmrBnBrvKAH5IlQjIXL0GiM1yr2l7paqFAYDB4PJvZ0/eondEa o4fjtAK7hWhplQlv01gchB+Ddq1kGZ7Qmch9CTsg= 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 #1505 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: 9b210f1c544ce4b0a4ff330c1e93d3ee83785484 X-Git-Newrev: ceb43210f8a6dfec98f634c326964328d1247f57 Message-Id: <20220831141015.955C33851ABC@sourceware.org> Date: Wed, 31 Aug 2022 14:10:15 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ceb43210f8a6dfec98f634c326964328d1247f57 commit ceb43210f8a6dfec98f634c326964328d1247f57 Merge: 9b210f1c544 5acb1375c9c Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Wed Aug 31 13:21:19 2022 +0000 Merge #1505 1505: Create canonical process of compiling constant items r=philberty a=philberty In order to compile a block expression constant, the simplest way for us was to reuse what code we have and to generate an artifical function which does not get added to the translation unit. The constant then becomes a CALL_EXPR to this artifical function which we can pass to the constexpr evaluator to resolve the result of this artifical 'CALL_EXPR'. Before this patch we seperated the difference between block expressions and non block expressions in constants. So for non block expressions we simply compiled them as if it was a simple constant but this is not guaranteed to be the case in rust, for example coercion sites can generate temporaries during autoderef which we let the constant evaluator resolve for us. This makes all constants handled in the same way to simplify the logic here. Co-authored-by: Philip Herron Diff: gcc/rust/backend/rust-compile-base.cc | 103 ++++++++++++++++++---------------- gcc/rust/backend/rust-tree.cc | 22 +------- 2 files changed, 56 insertions(+), 69 deletions(-)