Commits
Click on a commit to change the comparison rangefix(ast_macros): do not panic in macro (#13102)
Previously if you edited an AST struct, adding or removing fields, `#[ast]` macro would panic because the fields of the struct don't match what it's expecting from the `STRUCTS` metadata which is generated by `oxc_ast_tools`.
It would cover the whole struct with red squiggles, with a cryptic error message. This was really annoying.
Instead, make the macro output a `compile_error!` macro invocation. This makes IDE and `cargo build` show an error saying that you need to run `just ast` to re-run the codegen. Also, because the macro doesn't crash any more, you don't have to re-start Rust Analyser once you've fixed the problem.
This is less annoying for humans, and also the more helpful error message will hopefully point AI in the right direction.3 months ago
by overlookmotel