You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new 0.19.1 version of strum_macros panics when reaches the dot operator expression in attributes metadata which might be used by snafu macros for example (see reproduction in the end).
The error message is so unhelpful that to understand where the bug comes from one needs clone this repo
and do a binary search with synthetically inserting panic!("Here") in code here and there.
The error message
error: proc-macro derive panicked
--> crates/foo/src/main.rs:10:10
|
10 | #[derive(IntoStaticStr)]
| ^^^^^^^^^^^^^
|
= help: message: called `Result::unwrap()` on an `Err` value: Error("expected `,`")
At the end of the day the panic comes from syn on this line of code:
Change that unwrap() to expect("Boom") to check that this really is the place of panic.
Reproduction (panics on 0.19.1 of strum_macros, but version 0.18.0 works fine):
use snafu::Snafu;// "0.6.8"use strum_macros::IntoStaticStr;#[derive(Debug)]structInner{foo:&'staticstr}#[derive(Debug,Snafu)]#[derive(IntoStaticStr)]// if you comment out this line, the crate compiles wellenumError{#[snafu(display("Inner: {}", inner.foo))]// inner.foo syntax causes the panic (probably the dot)A{inner:Inner}}fnmain(){dbg!(Error::A{ inner:Inner{ foo:"bar"}});}
The new
0.19.1
version ofstrum_macros
panics when reaches the dot operator expression in attributes metadata which might be used bysnafu
macros for example (see reproduction in the end).The error message is so unhelpful that to understand where the bug comes from one needs clone this repo
and do a binary search with synthetically inserting
panic!("Here")
in code here and there.The error message
At the end of the day the panic comes from
syn
on this line of code:strum/strum_macros/src/helpers/has_metadata.rs
Line 14 in a11862c
Change that
unwrap()
toexpect("Boom")
to check that this really is the place of panic.Reproduction (panics on
0.19.1
ofstrum_macros
, but version0.18.0
works fine):cc #100
The text was updated successfully, but these errors were encountered: