Closed lenscas closed 2 years ago
Thanks for the report. I'll look into it.
Okay, so, quick update to confirm I can indeed reproduce the bug. (Sorry for the month-long silence)
I'm trying to find why.
(Sorry for the month-long silence)
Don't worry. Life happens :) (Also, I decided to have this macro not work with generics for the time being as it is complicated enough as it is and getting the traits it implements to work correctly once generics are involved is also not exactly easy when doing it by hand. Doing it as part of a macro is just pain)
Yeah, macros with generics are still a pretty janky part of Rust.
I decided to give venial a try for my proc macros as it seems easier than syn for my purposes. However, I ran into a bug where the proc macro crashes with the error
Unballanced brackets in type expression.
despite the rust code being correctly formatted.The rust code in question:
Curiously, adding a
,
after theClone
will make this error go away, as in this code works:repo that this happened in: https://github.com/lenscas/tealr/tree/chore/improve_proc_macros relevant files are https://github.com/lenscas/tealr/blob/chore/improve_proc_macros/tealr_derive/src/lib.rs#L48 (function that declares the derive macro)
https://github.com/lenscas/tealr/blob/388e7133a1b66cc9ee915e36ddac428bf1979329/tealr_derive/src/user_data.rs#L21 (function that creates the trait impl. I commented everything out to make sure the crash was not in my own code)
https://github.com/lenscas/tealr/blob/388e7133a1b66cc9ee915e36ddac428bf1979329/tealr/examples/rlua/derive.rs#L20 (example I use for testing, which contains the changes to get venial to panic)