diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-03-19 16:20:07 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-03-23 07:13:31 +1100 |
| commit | 31df6807893bd9c66cba57ff0f4de89ab9d8460e (patch) | |
| tree | 121e04e98fc7e52ab7087a3f7b05041eab4521e3 /compiler/rustc_codegen_gcc/example/example.rs | |
| parent | 754dc8e66f77da219a077d147009816e8275eed3 (diff) | |
| download | rust-31df6807893bd9c66cba57ff0f4de89ab9d8460e.tar.gz rust-31df6807893bd9c66cba57ff0f4de89ab9d8460e.zip | |
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}`.
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/example.rs')
0 files changed, 0 insertions, 0 deletions
