]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Cleanup and Assertion
authorParthib <parthibdutta02@gmail.com>
Mon, 6 Mar 2023 02:04:43 +0000 (07:34 +0530)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:21:08 +0000 (18:21 +0100)
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>
gcc/rust/hir/rust-ast-lower-type.cc
gcc/rust/rust-object-export.cc

index 472e4c550e4e852baa86d4aa754cdc59a847acb0..480e078a4e166d50b25a1af9828e4e16a54b14c1 100644 (file)
@@ -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));
     }
index 6f4a9b7e8eb4e20ddae48a809582cda735e9286d..21f66a3ebace2573b4f7b91c1202b947e1e18089 100644 (file)
@@ -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.