From: Arthur Cohen Date: Tue, 26 Nov 2024 16:34:37 +0000 (+0000) Subject: gccrs: stacked-contexts: Add peek() method X-Git-Tag: basepoints/gcc-16~1001 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa784e818c2712c6fabe749919d455d995688cf6;p=thirdparty%2Fgcc.git gccrs: 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 --git a/gcc/rust/util/rust-stacked-contexts.h b/gcc/rust/util/rust-stacked-contexts.h index 39a0c08de79..fe0bc8a291b 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? */