https://gcc.gnu.org/g:3abf72465b1490468482133ff3e000c18e6f6091
commit 3abf72465b1490468482133ff3e000c18e6f6091 Author: Arthur Cohen <arthur.co...@embecosm.com> Date: Tue Nov 26 16:34:37 2024 +0000 stacked-contexts: Add peek() method gcc/rust/ChangeLog: * util/rust-stacked-contexts.h: Add new method to see what context we are currently in. Diff: --- gcc/rust/util/rust-stacked-contexts.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/rust/util/rust-stacked-contexts.h b/gcc/rust/util/rust-stacked-contexts.h index 86cdf9f88d2a..d537d6ec451b 100644 --- a/gcc/rust/util/rust-stacked-contexts.h +++ b/gcc/rust/util/rust-stacked-contexts.h @@ -71,6 +71,13 @@ public: return last; } + const T &peek () + { + rust_assert (!stack.empty ()); + + return stack.back (); + } + /** * Are we currently inside of a special context? */