From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 4AF3B3857708 for ; Tue, 30 Jan 2024 12:11:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4AF3B3857708 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4AF3B3857708 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616765; cv=none; b=YrMQ1hCrbyDZbpKSbLT7jYY+uAYMR3lszoUmSIDhLc7hiKOpE9bjLGOPrx0b+7OOUX6vJgQW7PxKfiN3h7RXQm9md/B6YSy3P/rkKo3xkw0yjV8BFjzq5aHaBchke16uspvr6yFVuyZ7wWm2MEg/46+D43Dclz1Z4h7juI6MWEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706616765; c=relaxed/simple; bh=irBJwNhO1l3ARJPuyLTROgho9tbJ40AQ8Zi8AFDQ6Jw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BFEIdftyu5XX/C6hUJyq5FDEoHCyXzK1Dibil4b0uo1KPnYtIX6Fr+nrGbXIqYAgYw95BP++XtB7hZ2BLiwwps+BVTMCng4OpUAJyJKpDGnhbN2o9YwAg9BXXssC21LUzXXsV4XEo+vQp4sO4750gT2cHvSY6G8nLznSAMXK/CE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33af3c7ef60so1152349f8f.0 for ; Tue, 30 Jan 2024 04:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1706616713; x=1707221513; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=+V0ES9rIlpfph/NGd5qjXXQp2pTd9XhCqRBek8WS8jk=; b=cOKDsyj3ZN8hXZs/j/IPd8VcZYS8fhBFJS79TGuhvLhppSWRzh/ms1Dca0OzuMCq0E XUseS5A9Rnec0hSQ00TQXZX2c5vMp9CB+8vxnD2CwoVYQL11wryvgT02lsBh1ysYFDkg FvDmEos/U/pO6pJBOLCx3SXVOAIPxdMjC06vtNLRdfs9pr1cbrTu4eQMludr7LikMRBh OdzJKFpofwpkecDcqBY/UFTH8Q+gjOOgGA/gmIWuL41NZbF2wpwPYRUbCi6yqWtqvNk5 VKn1zw5xlcGof33SDf3AmrdMF6MyUfCcgXZDw2BCUXV2lUl9v+E6QxcsNA7ub3cpJkPV ISgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706616713; x=1707221513; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+V0ES9rIlpfph/NGd5qjXXQp2pTd9XhCqRBek8WS8jk=; b=Runpv629Rkeo/TGkBsEaAUrscKPS2Q52ts3obzZpxZHprfxsNk3amuF8zBS5OPfIuj 9kZzM+pD8i4/R7VYH6YJ98X9kwpe5B0vZaHYpkYLv6iV34JLgCq1Mm+6CJeO9iBWPfM0 Nv+HfPo0kpsNTo90ERYzYAb5gihdiofOb+8wOFwQmTGI3GbBemPqtocLG0KMlnkEbogZ aQZxALB0KyVB6C5cRJ8S6BQIdPlLqNu4D/fV+YM1xbRtL0IcH7dTZqHPP4tU5+Swsftj R86PgKbFvfDeAST6H7b37vC4VJuxFpwdtrHT31a+C16JM+6y7tw8/vs6fo+UvT1MJi5F zdJw== X-Gm-Message-State: AOJu0YwLKj1BipKZTuyxOHnhZWGT2UTGedB40g8cDO4v2fEkaIIZzrmA SqX5zVV/M3xL3zelsP/MQMrprJSoBgLxDoiz2I70bni9hYK/mQOHsFxD05rywT4kAzQbyYLAuSv rgA== X-Google-Smtp-Source: AGHT+IHYssxNgPH5xqlaty5iajl/rdVUq2pbaUKg2ivaLtAiwEPvw02uVJZJqi7OGACBQ0kQ1Gw7Tw== X-Received: by 2002:a5d:510f:0:b0:33a:e7de:aa8b with SMTP id s15-20020a5d510f000000b0033ae7deaa8bmr4448042wrt.26.1706616712489; Tue, 30 Jan 2024 04:11:52 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id f9-20020a056000036900b00339307d9d31sm10569894wrf.112.2024.01.30.04.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:11:52 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Jakub Dupak Subject: [COMMITTED 087/101] gccrs: TyTy: Refactor FnType deprecated API Date: Tue, 30 Jan 2024 13:07:43 +0100 Message-ID: <20240130121026.807464-90-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240130121026.807464-2-arthur.cohen@embecosm.com> References: <20240130121026.807464-2-arthur.cohen@embecosm.com> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Jakub Dupak gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Use new API. * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use new API. * typecheck/rust-tyty-cmp.h: Remove old API. * typecheck/rust-tyty.cc (FnPtr::is_equal): Use new API. * typecheck/rust-tyty.h: Remove old API. * typecheck/rust-unify.cc (UnifyRules::expect_fnptr): Use new API. Signed-off-by: Jakub Dupak --- gcc/rust/backend/rust-compile-expr.cc | 2 +- gcc/rust/typecheck/rust-tyty-call.cc | 2 +- gcc/rust/typecheck/rust-tyty-cmp.h | 6 +++--- gcc/rust/typecheck/rust-tyty.cc | 2 +- gcc/rust/typecheck/rust-tyty.h | 3 --- gcc/rust/typecheck/rust-unify.cc | 6 +++--- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index e0917f68660..596b848849e 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -1198,7 +1198,7 @@ CompileExpr::visit (HIR::CallExpr &expr) if (base->get_kind () == TyTy::TypeKind::FNPTR) { const TyTy::FnPtr *fn = static_cast (base); - *result = fn->param_at (index); + *result = fn->get_param_type_at (index); return true; } diff --git a/gcc/rust/typecheck/rust-tyty-call.cc b/gcc/rust/typecheck/rust-tyty-call.cc index 31afe046a13..a28780bcac3 100644 --- a/gcc/rust/typecheck/rust-tyty-call.cc +++ b/gcc/rust/typecheck/rust-tyty-call.cc @@ -271,7 +271,7 @@ TypeCheckCallExpr::visit (FnPtr &type) for (auto &argument : call.get_arguments ()) { location_t arg_locus = argument->get_locus (); - BaseType *fnparam = type.param_at (i); + BaseType *fnparam = type.get_param_type_at (i); auto argument_expr_tyty = Resolver::TypeCheckExpr::Resolve (argument.get ()); if (argument_expr_tyty->get_kind () == TyTy::TypeKind::ERROR) diff --git a/gcc/rust/typecheck/rust-tyty-cmp.h b/gcc/rust/typecheck/rust-tyty-cmp.h index 6d4bc16bf6e..98ff1dc664e 100644 --- a/gcc/rust/typecheck/rust-tyty-cmp.h +++ b/gcc/rust/typecheck/rust-tyty-cmp.h @@ -800,8 +800,8 @@ public: for (size_t i = 0; i < base->num_params (); i++) { - auto this_param = base->param_at (i); - auto other_param = type.param_at (i); + auto this_param = base->get_param_type_at (i); + auto other_param = type.get_param_type_at (i); if (!this_param->can_eq (other_param, emit_error_flag)) { BaseCmp::visit (type); @@ -830,7 +830,7 @@ public: for (size_t i = 0; i < base->num_params (); i++) { - auto this_param = base->param_at (i); + auto this_param = base->get_param_type_at (i); auto other_param = type.param_at (i).second; if (!this_param->can_eq (other_param, emit_error_flag)) { diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index e9b42ebebee..f1789f008a0 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -2123,7 +2123,7 @@ FnPtr::is_equal (const BaseType &other) const for (size_t i = 0; i < num_params (); i++) { - if (!param_at (i)->is_equal (*other2.param_at (i))) + if (!get_param_type_at (i)->is_equal (*other2.get_param_type_at (i))) return false; } return true; diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 2ed407ee169..b04048f400d 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -926,9 +926,6 @@ public: size_t num_params () const { return params.size (); } - // DEPRECATED: Use get_param_type_at - BaseType *param_at (size_t idx) const { return get_param_type_at (idx); } - void accept_vis (TyVisitor &vis) override; void accept_vis (TyConstVisitor &vis) const override; diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc index 3027f099739..8b43380cc59 100644 --- a/gcc/rust/typecheck/rust-unify.cc +++ b/gcc/rust/typecheck/rust-unify.cc @@ -1009,8 +1009,8 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype) for (size_t i = 0; i < ltype->num_params (); i++) { - auto a = ltype->param_at (i); - auto b = type.param_at (i); + auto a = ltype->get_param_type_at (i); + auto b = type.get_param_type_at (i); auto unified_param = UnifyRules::Resolve (TyTy::TyWithLocation (a), @@ -1058,7 +1058,7 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype) for (size_t i = 0; i < ltype->num_params (); i++) { - auto this_param = ltype->param_at (i); + auto this_param = ltype->get_param_type_at (i); auto other_param = type.param_at (i).second; auto unified_param -- 2.42.1