aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-08-26 20:52:35 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-31 11:36:52 +0100
commit5175404928bc5081506d0eb4cab193e8689f879b (patch)
tree8c6e68db6e219fd7a42deb91270b40b9195bd604 /gcc
parentebb127f2aed32f21a37b31e8a5330defc6bfe5e7 (diff)
downloadgcc-5175404928bc5081506d0eb4cab193e8689f879b.zip
gcc-5175404928bc5081506d0eb4cab193e8689f879b.tar.gz
gcc-5175404928bc5081506d0eb4cab193e8689f879b.tar.bz2
Add guards against getting data from an empty vector
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-tyctx.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-tyctx.cc b/gcc/rust/typecheck/rust-tyctx.cc
index d8a49e8..c46d590 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;
}