diff options
author | Parthib <parthibdutta02@gmail.com> | 2023-03-06 07:34:43 +0530 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:21:08 +0100 |
commit | e9e0f8bf8bc76bfd5369e0d3f8a74d3ffc9e1669 (patch) | |
tree | fc37246bbbc10cae2d0b7cba3aed3d4a631149be /gcc | |
parent | 234e7176a5d337af632b67380163d7bbd3526f3a (diff) | |
download | gcc-e9e0f8bf8bc76bfd5369e0d3f8a74d3ffc9e1669.zip gcc-e9e0f8bf8bc76bfd5369e0d3f8a74d3ffc9e1669.tar.gz gcc-e9e0f8bf8bc76bfd5369e0d3f8a74d3ffc9e1669.tar.bz2 |
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 <parthibdutta02@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-type.cc | 22 | ||||
-rw-r--r-- | 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 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<HIR::TypePathSegment> (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<HIR::TypePathSegment> associated_segment (translated_segment); std::vector<std::unique_ptr<HIR::TypePathSegment>> 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<HIR::TypePathSegment> (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. |