From: Philip Herron <[email protected]>
gcc/rust/ChangeLog:
* typecheck/rust-tyctx.cc (TypeCheckContext::pop_return_type): Add
guards around `std::vector<T>.pop_back()`.
(TypeCheckContext::peek_context): Likewise for `std::vector<T>.back()`.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/rust/typecheck/rust-tyctx.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/rust/typecheck/rust-tyctx.cc b/gcc/rust/typecheck/rust-tyctx.cc
index ad5f67cc1dd..af86b064c6c 100644
--- a/gcc/rust/typecheck/rust-tyctx.cc
+++ b/gcc/rust/typecheck/rust-tyctx.cc
@@ -142,12 +142,14 @@ TypeCheckContext::push_return_type (TypeCheckContextItem
item,
void
TypeCheckContext::pop_return_type ()
{
+ rust_assert (!return_type_stack.empty ());
return_type_stack.pop_back ();
}
TypeCheckContextItem &
TypeCheckContext::peek_context ()
{
+ rust_assert (!return_type_stack.empty ());
return return_type_stack.back ().first;
}
--
2.39.1
--
Gcc-rust mailing list
[email protected]
https://gcc.gnu.org/mailman/listinfo/gcc-rust