diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-08-23 22:21:05 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-08-29 13:00:17 +0000 |
commit | 5b5aadb643cff7d19d51a60506a45676cee533a9 (patch) | |
tree | 0010a6cc1819980eae6ca0d0d6a8e4f900757e16 /gcc | |
parent | c2770bdd22d04823f76f6f8381ee98f59cf61ca1 (diff) | |
download | gcc-5b5aadb643cff7d19d51a60506a45676cee533a9.zip gcc-5b5aadb643cff7d19d51a60506a45676cee533a9.tar.gz gcc-5b5aadb643cff7d19d51a60506a45676cee533a9.tar.bz2 |
Add pop guard for binder
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check.h:
Add pop guard for binder
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check.h b/gcc/rust/typecheck/rust-hir-type-check.h index c85a839..eb0c849 100644 --- a/gcc/rust/typecheck/rust-hir-type-check.h +++ b/gcc/rust/typecheck/rust-hir-type-check.h @@ -349,6 +349,8 @@ private: /** 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. */ @@ -424,7 +426,8 @@ public: ~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 (); |