diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-10-25 18:15:10 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-10-27 10:26:32 +0100 |
commit | 1a8479839e944fa2a8abd5923b4b65ce6cc96401 (patch) | |
tree | 83c5fdca56f26f64346ff103bfcd06f3c8205687 /gcc/rust/hir | |
parent | 1a9746032345e1bffeb9ff2c92473bf90f843379 (diff) | |
download | gcc-1a8479839e944fa2a8abd5923b4b65ce6cc96401.zip gcc-1a8479839e944fa2a8abd5923b4b65ce6cc96401.tar.gz gcc-1a8479839e944fa2a8abd5923b4b65ce6cc96401.tar.bz2 |
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.
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-item.h | 21 |
1 files changed, 11 insertions, 10 deletions
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<std::unique_ptr<WhereClauseItem>> &get_items () + { + return where_clause_items; + } + const std::vector<std::unique_ptr<WhereClauseItem>> &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<Type> &get_type_aliased () { |