Parser error recovery in `syn` for better IDE support with proc-macros
For attribute macros and derive macros, if the macro is getting called at all, you know that
rustcthinks that the item is valid syntax and will not be producing an error. if you then get asynparse error, then you must be in a case wheresyndoesn’t support the syntaxrustcdoes, and in that case you had better tell the user that that’s the problem, becauserustcwon’t.For function-like macros that take expressions (or whatever existing syntax applies in the context of the macro call) as input, you can't know whether
rustcwill think your input is valid syntax or not, and it might be the case that if you just produce the input, there won’t be any syntax error and the user will be confused.
In both of these cases, you can’t be sure that just repeating the input will produce a syntax error. It may, as I said previously, just result in your macro mysteriously having no effect.
Discussion in the ATmosphere