about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/symbols
AgeCommit message (Collapse)AuthorLines
2025-06-28Use tidy to sort `sym::*` itemsYotam Ofek-15/+0
2025-02-08Rustfmtbjorn3-4/+4
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-4/+4
2023-10-26Fix symbols::tests::test_symbolsDavid Tolnay-1/+1
---- symbols::tests::test_symbols stdout ---- thread 'symbols::tests::test_symbols' panicked at library/proc_macro/src/bridge/client.rs:311:17: procedural macro API is used outside of a procedural macro
2023-01-04Simplify some iterator combinatorsMichael Goulet-2/+1
2021-03-26Use iter::zip in compiler/Josh Stone-1/+1
2020-12-13./x.py fmtArlie Davis-12/+3
2020-12-12Improve error handling in `symbols` proc-macroArlie Davis-0/+111
This improves how the `symbols` proc-macro handles errors. If it finds an error in its input, the macro does not panic. Instead, it still produces an output token stream. That token stream will contain `compile_error!(...)` macro invocations. This will still cause compilation to fail (which is what we want), but it will prevent meaningless errors caused by the output not containing symbols that the macro normally generates. This solves a small (but annoying) problem. When you're editing rustc_span/src/symbol.rs, and you get something wrong (dup symbol name, misordered symbol), you want to get only the errors that are relevant, not a burst of errors that are irrelevant. This change also uses the correct Span when reporting errors, so you get errors that point to the correct place in rustc_span/src/symbol.rs where something is wrong. This also adds several unit tests which test the `symbols` proc-macro. This commit also makes it easy to run the `symbols` proc-macro as an ordinary Cargo test. Just run `cargo test`. This makes it easier to do development on the macro itself, such as running it under a debugger. This commit also uses the `Punctuated` type in `syn` for parsing comma-separated lists, rather than doing it manually. The output of the macro is not changed at all by this commit, so rustc should be completely unchanged. This just improves quality of life during development.