How to provide quickfix recommendations in proc macros?

I really like how, when using procedural macros, you can use syn::Error to create really helpful compiler errors for people using your macros. When I use an LSP like RLS or Rust Analyzer, it often can provide quick fixes to compiler errors that I am getting.

Is there a way for my macro to provide a compiler error that offers up similar suggestions that the user can implement with a click of a button?

This isn't currently possible.

Is there an RFC about this or should I make one?

I'm not aware of any. Keep in mind that even diagnostics are unstable, so something like this would be quite a ways off. Feel free to post on IRLO; you can probably get some feedback from a number of people (myself likely included).

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.