]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: minor HIR cleanup
authorMarc Poulhiès <dkm@kataplop.net>
Wed, 12 Jul 2023 07:48:31 +0000 (09:48 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:36 +0000 (18:49 +0100)
Remove more rust_assert in accessors.

gcc/rust/ChangeLog:

* hir/tree/rust-hir-type.h (MaybeNamedParam::get_type): Remove
rust_assert.
(BareFunctionType::get_return_type): Likewise.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
gcc/rust/hir/tree/rust-hir-type.h

index 3d1f8de7d634bf25c3464556d59b11378588ae21..f6d5ab24f354a18cfcb44ed6f38d28b4c51ff71f 100644 (file)
@@ -742,11 +742,7 @@ public:
 
   Location get_locus () const { return locus; }
 
-  std::unique_ptr<Type> &get_type ()
-  {
-    rust_assert (param_type != nullptr);
-    return param_type;
-  }
+  std::unique_ptr<Type> &get_type () { return param_type; }
 
   ParamKind get_param_kind () const { return param_kind; }
 
@@ -829,11 +825,7 @@ public:
   }
 
   // TODO: would a "vis_type" be better?
-  std::unique_ptr<Type> &get_return_type ()
-  {
-    rust_assert (has_return_type ());
-    return return_type;
-  }
+  std::unique_ptr<Type> &get_return_type () { return return_type; }
 
 protected:
   /* Use covariance to implement clone function as returning this object rather