From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 3D9A43857348; Mon, 29 Aug 2022 15:31:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D9A43857348 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661787118; bh=fG5nS3OzIiH0NBP33C+mgdS/zMjyV72MrrwSjUSxLDA=; h=From:To:Subject:Date:From; b=oOdX2DfNBPw2+YpeiJQYkR7aFY5HMj0iAdJ13qLd/kDXAmUS1zktFAvTsAeqSo1dw xjZzZ094hclGet4EoH0GXSE7ORjnp426xp9HvcDyDeAtqNemGOYtxEPAbEaHrvEzSS ZoFO4BVcd7up9mS7/cDvrY4HEOp4vcP5D+upQvOI= 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 #1497 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: 241fcaacf600fa4c149d30afa2cf1a42f57c9a0c X-Git-Newrev: 825a44b40ce6cfa76470e53d0746b1e64b99ee5b Message-Id: <20220829153158.3D9A43857348@sourceware.org> Date: Mon, 29 Aug 2022 15:31:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:825a44b40ce6cfa76470e53d0746b1e64b99ee5b commit 825a44b40ce6cfa76470e53d0746b1e64b99ee5b Merge: 241fcaacf60 36a9255b1b6 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Tue Aug 23 19:16:47 2022 +0000 Merge #1497 1497: Refactor our casts to follow the Rustc implemention r=philberty a=philberty This gets rid of our old visitor system for cast type checking. Casts depend on type coercions as they are meant to attempt a type coercion before trying a simple cast. This explicitly defines the rules which should be allowed for simple casts. In rustc they use match expressions to write a list of casts which should not be allowed. We have likely missed some rules of what should be allowed but this is at least the start of how to implement this. Fixes #1496 Co-authored-by: Philip Herron Diff: gcc/rust/Make-lang.in | 1 + gcc/rust/backend/rust-compile-expr.cc | 24 +- gcc/rust/typecheck/rust-casts.cc | 292 +++++ gcc/rust/typecheck/rust-casts.h | 53 + gcc/rust/typecheck/rust-coercion.cc | 89 +- gcc/rust/typecheck/rust-coercion.h | 16 +- gcc/rust/typecheck/rust-hir-type-check-base.cc | 33 +- gcc/rust/typecheck/rust-hir-type-check-base.h | 7 +- gcc/rust/typecheck/rust-hir-type-check-expr.cc | 15 +- gcc/rust/typecheck/rust-hir-type-check.h | 20 + gcc/rust/typecheck/rust-tyty-cast.h | 1425 ---------------------- gcc/rust/typecheck/rust-tyty.cc | 178 +-- gcc/rust/typecheck/rust-tyty.h | 64 +- gcc/testsuite/rust/execute/torture/issue-1496.rs | 75 ++ 14 files changed, 600 insertions(+), 1692 deletions(-)