Parser error recovery in `syn` for better IDE support with proc-macros
Rust Internals [Unofficial]
May 31, 2026
FWIW, what you should do when syn fails to parse is to return the original code unchanged. This is better for both IDEs and the compiler, although it's not a common practice unfortunately.
Discussion in the ATmosphere