From e9e0f8bf8bc76bfd5369e0d3f8a74d3ffc9e1669 Mon Sep 17 00:00:00 2001 From: Parthib Date: Mon, 6 Mar 2023 07:34:43 +0530 Subject: gccrs: 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 --- gcc/rust/hir/rust-ast-lower-type.cc | 22 ++++++---------------- gcc/rust/rust-object-export.cc | 3 +-- 2 files changed, 7 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc index 472e4c5..480e078 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 6f4a9b7..21f66a3 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-2024 Free Software Foundation, Inc. +/* Copyright (C) 2010-2024 Free Software Foundation, Inc. This file is part of GCC. -- cgit v1.1