]> git.lizzy.rs Git - rust.git/commit
Remove `LazyTokenStream`.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 14 Feb 2019 22:10:02 +0000 (09:10 +1100)
committerNicholas Nethercote <nnethercote@mozilla.com>
Sun, 17 Feb 2019 22:46:33 +0000 (09:46 +1100)
commitf8801f3bf641f0277087e6621d09f9a6a373b36c
treed58803ac7c531e5911f4f3e17d843f80ac401708
parentd26bf742db0754893567401e49ae8b016c878a92
Remove `LazyTokenStream`.

It's present within `Token::Interpolated` as an optimization, so that if
a nonterminal is converted to a `TokenStream` multiple times, the
first-computed value is saved and reused.

But in practice it's not needed. `interpolated_to_tokenstream()` is a
cold function: it's only called a few dozen times while compiling rustc
itself, and a few hundred times across the entire `rustc-perf` suite.
Furthermore, when it is called, it is almost always the first
conversion, so no benefit is gained from it.

So this commit removes `LazyTokenStream`, along with the now-unnecessary
`Token::interpolated()`.

As well as a significant simplification, the removal speeds things up
slightly, mostly due to not having to `drop` the `LazyTokenStream`
instances.
13 files changed:
src/librustc/hir/map/def_collector.rs
src/librustc_resolve/build_reduced_graph.rs
src/libsyntax/attr/mod.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/transcribe.rs
src/libsyntax/mut_visit.rs
src/libsyntax/parse/attr.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/libsyntax_ext/deriving/custom.rs