rust/compiler/rustc_expand/src
Nicholas Nethercote 31df680789 Eliminate TokenTreeOrTokenTreeSlice.
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-23 07:13:31 +11:00
..
mbe Eliminate TokenTreeOrTokenTreeSlice. 2022-03-23 07:13:31 +11:00
mut_visit rustc_ast: Turn MutVisitor::token_visiting_enabled into a constant 2021-10-18 00:23:24 +03:00
parse re-format with new rustfmt 2021-11-30 13:08:41 -05:00
tokenstream Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
base.rs rustc_error: make ErrorReported impossible to construct 2022-03-16 10:35:24 -05:00
build.rs Include ignore message in libtest output 2022-02-24 17:36:36 -05:00
config.rs Move the set of features to the features query. 2022-03-03 18:08:30 +01:00
expand.rs Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber 2022-03-15 03:56:33 +00:00
lib.rs Remove MatcherPosHandle. 2022-03-21 10:08:29 +11:00
mbe.rs Eliminate TokenTreeOrTokenTreeSlice. 2022-03-23 07:13:31 +11:00
module.rs Associate multiple with a crate too. 2022-03-03 18:45:25 -05:00
placeholders.rs Associate multiple with a crate too. 2022-03-03 18:45:25 -05:00
proc_macro_server.rs all: fix some typos 2022-03-03 19:47:23 +08:00
proc_macro.rs rustc_error: make ErrorReported impossible to construct 2022-03-16 10:35:24 -05:00
tests.rs Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00