-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can From* derivations point to meta item's span in error cases? #39
Comments
I've found a way to do this that shouldn't break existing usage of |
cc @Eijebong as an FYI |
Documenting the plan for posterity:
match MyReceiver::from_derive_input(&input) {
Ok(val) => { /* ... */ },
Err(e) => { e.emit(); panic!("Diagnostics failed"); }
} Note that I'm not sure what the macro is supposed to do after emitting diagnostics: Does it just hand back the unmodified token stream? |
This should dramatically improve span coverage for #39. The library won't be able to use this until diagnostics stabilize in Rust though.
This came up on reddit; it's likely a barrier to adoption of the library, and should be fixed. |
I think this is fixed by the release of v0.8.4 |
If I understand some of the proc-macro2 goals correctly,
darling
should be able to pinpoint the offending term in the input as the span, rather than the name of the macro.Open Questions
darling::Error
interface? Probably. We'd want that interface to support taking an ident or span.darling
surface multiple errors from a single invocation?The text was updated successfully, but these errors were encountered: