aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorParthib <parthibdutta02@gmail.com>2023-03-06 07:34:43 +0530
committerPhilip Herron <philip.herron@embecosm.com>2023-03-06 12:36:16 +0000
commit136c765c748ab283eb95868b05da1269694e60be (patch)
treea04b456d981ca9e29bd266aced2b01b73a9ea9f7 /gcc/rust
parentae91a0a3f2b44e5b011d3742a71c3c5030558bc8 (diff)
downloadgcc-136c765c748ab283eb95868b05da1269694e60be.zip
gcc-136c765c748ab283eb95868b05da1269694e60be.tar.gz
gcc-136c765c748ab283eb95868b05da1269694e60be.tar.bz2
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/rust')
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.cc22
-rw-r--r--gcc/rust/rust-object-export.cc3
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 9ea22b0..d767de6 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 1143c76..c2e56fe 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.