From 1a8479839e944fa2a8abd5923b4b65ce6cc96401 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 25 Oct 2021 18:15:10 +0100 Subject: Remove assertion for has_where_clause This assertion doesn't protect against bad pointers or behaviour, when we access the where clause it is simply a wrapper over a vector of where clause items so we can safely iterate even when the where clause item vector is empty. --- gcc/rust/hir/tree/rust-hir-item.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'gcc/rust/hir') diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index de067e6..4fdd764 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -340,6 +340,15 @@ public: bool is_empty () const { return where_clause_items.empty (); } std::string as_string () const; + + std::vector> &get_items () + { + return where_clause_items; + } + const std::vector> &get_items () const + { + return where_clause_items; + } }; // A self parameter in a method @@ -1205,11 +1214,7 @@ public: Identifier get_function_name () const { return function_name; } // TODO: is this better? Or is a "vis_block" better? - WhereClause &get_where_clause () - { - rust_assert (has_where_clause ()); - return where_clause; - } + WhereClause &get_where_clause () { return where_clause; } bool has_return_type () const { return return_type != nullptr; } @@ -1322,11 +1327,7 @@ public: return generic_params; } - WhereClause &get_where_clause () - { - rust_assert (has_where_clause ()); - return where_clause; - } + WhereClause &get_where_clause () { return where_clause; } std::unique_ptr &get_type_aliased () { -- cgit v1.1