Parser error recovery in `syn` for better IDE support with proc-macros
Rust Internals [Unofficial]
May 31, 2026
chrefr:
Sure, in that case you have to decide between the complexity of doing as much of the transformation as you can and the cost of having incomplete code not supported by the IDE.
yeah, currently that errs on the incomplete code doesn't work at all end, since I use syn to parse the input and there aren't really any viable stable alternatives.
chrefr:
(Also, rust-analyzer does not currently support expression attributes. But that's orthogonal).
it gets used inside a attribute macro on a function, so the attribute macro can walk the function body's AST and do transformations on attributes on expressions when it finds them:
#[hdl_module]
fn my_module() {
#[hdl]
match todo!() {
T::A => todo!(),
}
}
Discussion in the ATmosphere