diff options
author | Parthib <parthibdutta02@gmail.com> | 2023-03-06 07:34:43 +0530 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-03-06 12:36:16 +0000 |
commit | 136c765c748ab283eb95868b05da1269694e60be (patch) | |
tree | a04b456d981ca9e29bd266aced2b01b73a9ea9f7 /gcc/rust/hir | |
parent | ae91a0a3f2b44e5b011d3742a71c3c5030558bc8 (diff) | |
download | gcc-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/hir')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-type.cc | 22 |
1 files changed, 6 insertions, 16 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)); } |