Re: [PATCH 1/2] rust: macros: improve panic messages

From: Miguel Ojeda
Date: Fri Feb 07 2025 - 13:12:31 EST


On Fri, Feb 7, 2025 at 6:22 PM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
>
> Include unexpected input on parsing failures. This has the side effect
> of avoiding a spurious rust-analyzer warning:
>
> Variable `None` should have snake_case name, e.g. `none`

Hmm... That should be solved independently, but sure.

In any case, how is this related to the second patch in the series?
i.e. do you need both to solve the macOS issue?

> + let Some(token) = it.next() else {
> + break;
> + };
> + match token {
> + TokenTree::Punct(punct) => assert_eq!(punct.as_char(), ','),
> + token => panic!("Expected ',' or end of array, got {}", token),

Do we want to shadow here?

Also, I think you could write `{token}`. Same above.

Could you please show how the new output would look like in the commit message?

Cheers,
Miguel