From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 3B4F13858C54; Wed, 8 Mar 2023 09:56:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B4F13858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678269365; bh=HgTZ0Syj9gKzgDmF5SjjyCf5T9GO55SB0MDAxB97A1A=; h=From:To:Subject:Date:From; b=ohZOM49qXoqh50ZL2R/xiVmpZLBJHkgUePl/zXTI/o+pdWc1uE1LI2PTbodaqVEHU bDR8vG19ICKRbe22vxtyjWtokL47tr/sLiXASPM0GrAyOiNFvps2vOd/TfNT+R5mOQ C6yAo6HeHJObDJmB94Ds83zHUoLxyWdEEJiiHPz4= 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] Cleanup and Assertion X-Act-Checkin: gcc X-Git-Author: Parthib X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: ae91a0a3f2b44e5b011d3742a71c3c5030558bc8 X-Git-Newrev: 136c765c748ab283eb95868b05da1269694e60be Message-Id: <20230308095605.3B4F13858C54@sourceware.org> Date: Wed, 8 Mar 2023 09:56:05 +0000 (GMT) List-Id: https://gcc.gnu.org/g:136c765c748ab283eb95868b05da1269694e60be commit 136c765c748ab283eb95868b05da1269694e60be Author: Parthib Date: Mon Mar 6 07:34:43 2023 +0530 Cleanup and Assertion gcc/rust/ChangLog: * rust-object-export.cc: Modified * hir/rust-ast-lower-type.cc (rust_fatal_error): Removed (rust_assert): Added Signed-off-by: Parthib Diff: --- gcc/rust/hir/rust-ast-lower-type.cc | 22 ++++++---------------- gcc/rust/rust-object-export.cc | 3 +-- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc index 9ea22b01f32..d767de6f699 100644 --- a/gcc/rust/hir/rust-ast-lower-type.cc +++ b/gcc/rust/hir/rust-ast-lower-type.cc @@ -108,11 +108,8 @@ ASTLowerTypePath::visit (AST::TypePath &path) { translated_segment = nullptr; seg->accept_vis (*this); - if (translated_segment == nullptr) - { - rust_fatal_error (seg->get_locus (), - "failed to translate AST TypePathSegment"); - } + rust_assert (translated_segment != nullptr); + translated_segments.push_back ( std::unique_ptr (translated_segment)); } @@ -158,12 +155,8 @@ ASTLowerQualifiedPathInType::visit (AST::QualifiedPathInType &path) translated_segment = nullptr; path.get_associated_segment ()->accept_vis (*this); - if (translated_segment == nullptr) - { - rust_fatal_error (path.get_associated_segment ()->get_locus (), - "failed to translate AST TypePathSegment"); - return; - } + rust_assert (translated_segment != nullptr); + std::unique_ptr associated_segment (translated_segment); std::vector> translated_segments; @@ -171,11 +164,8 @@ ASTLowerQualifiedPathInType::visit (AST::QualifiedPathInType &path) { translated_segment = nullptr; seg->accept_vis (*this); - if (translated_segment == nullptr) - { - rust_fatal_error (seg->get_locus (), - "failed to translte AST TypePathSegment"); - } + rust_assert (translated_segment != nullptr); + translated_segments.push_back ( std::unique_ptr (translated_segment)); } diff --git a/gcc/rust/rust-object-export.cc b/gcc/rust/rust-object-export.cc index 1143c767784..c2e56febfef 100644 --- a/gcc/rust/rust-object-export.cc +++ b/gcc/rust/rust-object-export.cc @@ -1,5 +1,4 @@ -/* rust-backend.c -- Rust frontend interface to gcc backend. - Copyright (C) 2010-2023 Free Software Foundation, Inc. +/* Copyright (C) 2010-2023 Free Software Foundation, Inc. This file is part of GCC.