aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-11-26 16:34:37 +0000
committerCohenArthur <arthur.cohen@embecosm.com>2024-12-02 14:35:30 +0000
commit3abf72465b1490468482133ff3e000c18e6f6091 (patch)
treea5ebb2cbe12d2cc7a34842a14bf50722dec16f68
parentafbd87358cc8b4627536145510b0c17634005eb6 (diff)
downloadgcc-3abf72465b1490468482133ff3e000c18e6f6091.zip
gcc-3abf72465b1490468482133ff3e000c18e6f6091.tar.gz
gcc-3abf72465b1490468482133ff3e000c18e6f6091.tar.bz2
stacked-contexts: Add peek() method
gcc/rust/ChangeLog: * util/rust-stacked-contexts.h: Add new method to see what context we are currently in.
-rw-r--r--gcc/rust/util/rust-stacked-contexts.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-stacked-contexts.h b/gcc/rust/util/rust-stacked-contexts.h
index 86cdf9f..d537d6e 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?
*/