Skip to content

Commit

Permalink
Add pop guard for binder
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check.h:
	Add pop guard for binder
  • Loading branch information
badumbatish authored and CohenArthur committed Aug 29, 2024
1 parent c2770bd commit 5b5aadb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gcc/rust/typecheck/rust-hir-type-check.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ class TypeCheckContext
/** Only to be used by the guard. */
void pop_binder () { binder_size_stack.pop (); }

bool binder_empty () { return binder_size_stack.empty (); }

/**
* Switch from resolving a function header to a function body.
*/
Expand Down Expand Up @@ -424,7 +426,8 @@ class TypeCheckContext
~LifetimeResolverGuard ()
{
rust_assert (!ctx.lifetime_resolver_stack.empty ());
ctx.lifetime_resolver_stack.top ().pop_binder ();
if (!ctx.lifetime_resolver_stack.top ().binder_empty ())
ctx.lifetime_resolver_stack.top ().pop_binder ();
if (kind == RESOLVER)
{
ctx.lifetime_resolver_stack.pop ();
Expand Down

0 comments on commit 5b5aadb

Please sign in to comment.