Parser error recovery in `syn` for better IDE support with proc-macros
Rust Internals [Unofficial]
May 31, 2026
kpreid:
So, I stand by my original suggestion: output a
compile_error!()and the unmodified input. That should get you the completion benefits and also a guaranteed error.
unfortunately it's still very annoying since the completions are wrong since the proc-macro's transformation doesn't happen. hence why I think syn (or some similar library that's intended to be used by stable code -- so not rustc_parse and not rust-analyzer's parser) should support parse error recovery so you get the correct parts parsed correctly and the broken parts producing a parse error node or similar.
Discussion in the ATmosphere