about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/mbe.rs
AgeCommit message (Collapse)AuthorLines
2025-06-24mbe: Clean up code with non-optional `NonterminalKind`Trevor Gross-2/+8
Since [1], the fragment specifier is unconditionally required in all editions. This means `NonTerminalKind` no longer needs to be optional, as we can reject this code during the expansion of `macro_rules!` rather than handling it throughout the code. Do this cleanup here. [1]: https://github.com/rust-lang/rust/pull/128425
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-05-23Add some comments.Nicholas Nethercote-0/+2
2024-05-23Clarify the meaning of the span within `mbe::TokenTree::MetaVar`.Nicholas Nethercote-1/+2
2024-05-03Remove unnecessary `pub`s.Nicholas Nethercote-5/+6
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-0/+1
2023-12-11Add spacing information to delimiters.Nicholas Nethercote-3/+3
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
2022-11-20Move macro_rules diagnostics to diagnostics moduleNilstrieb-0/+1
2022-11-02Add `Tracker` to track matching operationsNilstrieb-1/+1
This should allow us to collect detailed information without slowing down the inital hot path.
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-6/+6
2022-04-28rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`Vadim Petrochenkov-4/+4
2022-04-14`mbe::TokenTree`: remove `Lrc` around `Delimited` and `SequenceRepetition`.Nicholas Nethercote-4/+3
2022-04-14Introduce `TtHandle` and use it in `TokenSet`.Nicholas Nethercote-12/+0
This removes the last use of `<mbe::TokenTree as Clone>`. It also removes two trivial methods on `Delimited`.
2022-04-13`SequenceRepetition` and `Delimited` don't need to be `Clone`.Nicholas Nethercote-2/+2
2022-04-09Remove explicit delimiter token trees from `Delimited`.Nicholas Nethercote-34/+10
They were introduced by the final commit in #95159 and gave a performance win. But since the introduction of `MatcherLoc` they are no longer needed. This commit reverts that change, making the code a bit simpler.
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-23Eliminate `TokenTreeOrTokenTreeSlice`.Nicholas Nethercote-47/+41
As its name suggests, `TokenTreeOrTokenTreeSlice` is either a single `TokenTree` or a slice of them. It has methods `len` and `get_tt` that let it be treated much like an ordinary slice. The reason it isn't an ordinary slice is that for `TokenTree::Delimited` the open and close delimiters are represented implicitly, and when they are needed they are constructed on the fly with `Delimited::{open,close}_tt`, rather than being present in memory. This commit changes `Delimited` so the open and close delimiters are represented explicitly. As a result, `TokenTreeOrTokenTreeSlice` is no longer needed and `MatcherPos` and `MatcherTtFrame` can just use an ordinary slice. `TokenTree::{len,get_tt}` are also removed, because they were only needed to support `TokenTreeOrTokenTreeSlice`. The change makes the code shorter and a little bit faster on benchmarks that use macro expansion heavily, partly because `MatcherPos` is a lot smaller (less data to `memcpy`) and partly because ordinary slice operations are faster than `TokenTreeOrTokenTreeSlice::{len,get_tt}`.
2022-03-09Implement macro meta-variable expressionsCaio-6/+10
2021-04-19fix few typosklensy-1/+1
2020-12-22Revert "Promote missing_fragment_specifier to hard error"Wesley Wiser-1/+1
This reverts commit 02eae432e7476a0686633a8c2b7cb1d5aab1bd2c.
2020-10-30Fix some more clippy warningsJoshua Nelson-4/+1
2020-08-30mv compiler to compiler/mark-0/+152