From 1d75ff81e84432711bfd28457406067576025d49 Mon Sep 17 00:00:00 2001 From: Taus Date: Fri, 26 Jun 2026 14:06:12 +0000 Subject: [PATCH] yeast-macros: Add error message to defensive `expect_ident` in `parse_ctx_or_implicit` The empty error string passed to `expect_ident` was dead code (the preceding lookahead has already confirmed the token is an ident), but it would have been a confusing message if it ever fired. Replace with an explicit "unreachable" string that makes the intent clearer to readers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- shared/yeast-macros/src/parse.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/yeast-macros/src/parse.rs b/shared/yeast-macros/src/parse.rs index 2422d0a8a5c..6e4de57a141 100644 --- a/shared/yeast-macros/src/parse.rs +++ b/shared/yeast-macros/src/parse.rs @@ -304,7 +304,8 @@ fn parse_ctx_or_implicit(tokens: &mut Tokens) -> Ident { && matches!(lookahead.next(), Some(TokenTree::Punct(p)) if p.as_char() == ','); if is_explicit { - let ctx = expect_ident(tokens, "").unwrap(); + let ctx = expect_ident(tokens, "unreachable: ident was just peeked") + .expect("unreachable: ident was just peeked"); let _ = tokens.next(); // consume comma ctx } else {