Closed parasyte closed 7 months ago
String
has the same kind of problem. The derive macro passes a string literal, but it wants a heap-allocated String
. It needs to call .to_string()
on whatever is provided in the #[default(...)]
attribute.
And PathBuf
, too! Something like try_into()
or parse()
might work for all of these?
Boolean values
true
andfalse
are not literals. They are idents: https://dev-doc.rust-lang.org/beta/proc_macro/struct.Literal.html(emphasis added)
The bug is here: https://github.com/parasyte/onlyargs/blob/f331a2ecea9a64830dd59d0996846bbd857baaed/onlyargs_derive/src/parser.rs#L119
It needs a fallback to check for
true
andfalse
idents if the token is not a literal.