aboutsummaryrefslogtreecommitdiffstats
path: root/rust/macros/helpers.rs
diff options
authorGeoff Levand <geoff@infradead.org>2023-06-26 08:17:16 -0500
committerGeoff Levand <geoff@infradead.org>2023-06-26 08:17:16 -0500
commit98ec4e7cee0f26a1af070ffc697d82c0f2714848 (patch)
treeae7176bc5d6ad1cc65476e71e98142b91450956d /rust/macros/helpers.rs
parent917ca4e843ee2239821d891825ec4f121f97caa4 (diff)
parent84506709c1c3fcb2422eeee9e99fc93dffbaf289 (diff)
downloadps3-linux-master.tar.gz
Merge branch 'ps3-queue-v6.4'HEADmaster
Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'rust/macros/helpers.rs')
-rw-r--r--rust/macros/helpers.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/macros/helpers.rs b/rust/macros/helpers.rs
index cf7ad950dc1e24..b2bdd4d8c958af 100644
--- a/rust/macros/helpers.rs
+++ b/rust/macros/helpers.rs
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-use proc_macro::{token_stream, TokenTree};
+use proc_macro::{token_stream, Group, TokenTree};
pub(crate) fn try_ident(it: &mut token_stream::IntoIter) -> Option<String> {
if let Some(TokenTree::Ident(ident)) = it.next() {
@@ -56,6 +56,14 @@ pub(crate) fn expect_string_ascii(it: &mut token_stream::IntoIter) -> String {
string
}
+pub(crate) fn expect_group(it: &mut token_stream::IntoIter) -> Group {
+ if let TokenTree::Group(group) = it.next().expect("Reached end of token stream for Group") {
+ group
+ } else {
+ panic!("Expected Group");
+ }
+}
+
pub(crate) fn expect_end(it: &mut token_stream::IntoIter) {
if it.next().is_some() {
panic!("Expected end");