-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make TokenStream
less recursive.
#57004
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #57087) made this pull request unmergeable. Please resolve the merge conflicts. |
e2e57bb
to
facc038
Compare
`TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
facc038
to
e80a930
Compare
New code is ready for review. r? @eddyb |
(eddyb is absent, reassigning to me.) |
A bit of a history:
|
@bors try |
Make `TokenStream` less recursive. `TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
☀️ Test successful - status-travis |
@rust-timer build 7346647 |
Insufficient permissions to issue commands to rust-timer. |
@rust-timer build 7346647 |
Success: Queued 7346647 with parent 7ad470c, comparison URL. |
Finished benchmarking try commit 7346647 |
The performance results are basically a wash: some minor improvements, some minor regressions. (Which matches what I saw locally.) But note that the regressions are almost entirely within the short-running (and less interesting) benchmarks: |
📌 Commit e80a930 has been approved by |
Make `TokenStream` less recursive. `TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
💥 Test timed out |
⌛ Testing commit e80a930 with merge 8090a9c09bf365105ef844d61a2d69124e2c56fa... |
💔 Test failed - status-appveyor |
No idea about that, but it seems spurious, so... @bors retry |
⌛ Testing commit e80a930 with merge 7062e23180480c2f15a1f27a6d444b76b0419bd9... |
💔 Test failed - status-appveyor |
@bors retry |
…rochenkov Make `TokenStream` less recursive. `TokenStream` is currently recursive in *two* ways: - the `TokenTree` variant contains a `ThinTokenStream`, which can contain a `TokenStream`; - the `TokenStream` variant contains a `Vec<TokenStream>`. The latter is not necessary and causes significant complexity. This commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`. This reduces complexity significantly. In particular, `StreamCursor` is eliminated, and `Cursor` becomes much simpler, consisting now of just a `TokenStream` and an index. The commit also removes the `Extend` impl for `TokenStream`, because it is only used in tests. (The commit also removes those tests.) Overall, the commit reduces the number of lines of code by almost 200.
Rollup of 4 pull requests Successful merges: - #57004 (Make `TokenStream` less recursive.) - #57102 (NLL: Add union justifications to conflicting borrows.) - #57337 (rustc: Place wasm linker args first instead of last) - #57549 (Add #[must_use] message to Iterator and Future) Failed merges: r? @ghost
TokenStream
is currently recursive in two ways:the
TokenTree
variant contains aThinTokenStream
, which cancontain a
TokenStream
;the
TokenStream
variant contains aVec<TokenStream>
.The latter is not necessary and causes significant complexity. This
commit replaces it with the simpler
Vec<(TokenTree, IsJoint)>
.This reduces complexity significantly. In particular,
StreamCursor
iseliminated, and
Cursor
becomes much simpler, consisting now of just aTokenStream
and an index.The commit also removes the
Extend
impl forTokenStream
, because itis only used in tests. (The commit also removes those tests.)
Overall, the commit reduces the number of lines of code by almost 200.