Open pickx opened 1 year ago
Ah so that's the usecase, but why not just use parse2's error then? This also breaks the proc macro structure I've argued for in the blog post, we still want parsing to be done inside. Sorry that this basically means redoing the whole changeset.
Right I think I hated parse_macro_input!
because it won't take procmacro2_TokenStream
.
So first I would want to know what parse2 -> log/compile error says vs parse_macro_input
Right I think I hated
parse_macro_input!
because it won't takeprocmacro2_TokenStream
. So first I would want to know what parse2 -> log/compile error says vs parse_macro_input
yeah that's why I kept it in lib.rs
, so we don't get a mix of proc_macro::TokenStream
and proc_macro2::TokenStream
in the same file.
since this is always an error (and not bilge-specific) than presumably you'd want to not print anything, so the actual compile errors are the only thing the user sees
Sorry that this basically means redoing the whole changeset.
np, I have no strong feelings about this one
I dunno. Keeping parsing inside would be nice. I just tried around a bit and this would be the most sane version of it: https://github.com/hecatia-elegua/bilge/compare/main...invalid-syntax
if macro input is invalid, we go straight to
unreachable
, so something like thiswould panic with "entered unreachable code: should have already been validated".
syn::parse_macro_input!
seems like a more sanitary way to do this.