-
Notifications
You must be signed in to change notification settings - Fork 2
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
Does this work with custom derives? #2
Comments
Thanks for investigating and the MRE! Looks like it is important to pass in a span - otherwise it wont trigger (was not actively aware of that). #[proc_macro_derive(MyDerive)]
pub fn my_derive(input: TokenStream) -> TokenStream {
let input = syn::parse_macro_input!(input as syn::DeriveInput);
let warning = proc_macro_warning::Warning::new_deprecated("test")
.old("foo").new("bar")
.span(input.span()) // <- here
.build();
quote::quote!{ #warning }.into()
} Please let me know if this fixes your issue. I will add an example specifically for derive macros and maybe make the |
@tcoratger Mind trying this on libp2p/rust-libp2p#3848? |
Awesome, thank you! I hope this works :) |
Thanks! This now works. |
I am trying to use this with a custom-derive and it doesn't seem to work. Here is a MRE: https://github.com/thomaseizinger/proc-macro-warning-MRE
Any ideas?
The text was updated successfully, but these errors were encountered: