I've been working on some procedural macros recently, and I really like how you can use
syn::Error to create really helpful spanned compiler errors for people using your macros. Often, I will try to offer up a suggested change that the user could use to fix their code.
When I use an LSP like RLS or Rust Analyzer, it can often provide quick fixes to compiler errors that I am getting. With a click of a button or quick keypress, the fix is implemented for me much quicker than if I had needed to type it out myself.
What I am wondering about is whether this is something we could allow macro writers to add to their existing compiler errors. What I'm picturing is some sort of "substitution" struct that you could pass that encodes which span would be changed and the contents of the fixed code.
I'm not super familiar with how quick fixes are currently implemented in Rust language servers, so I'm not sure how difficult this would be to implement, but I'm curious what folks think about this type of feature.