-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Remove tokenstream::Delimited
.
#56369
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
Marking as blocked on #49219. |
Why is it blocked on #49219? |
☔ The latest upstream changes (presumably #49219) made this pull request unmergeable. Please resolve the merge conflicts. |
@nnethercote |
#49219 has landed; @nnethercote should be able to rebase this now. :) |
00e699a
to
8e4ccef
Compare
@eddyb: I have rebased. |
src/libsyntax/tokenstream.rs
Outdated
@@ -146,15 +102,15 @@ impl TokenTree { | |||
pub fn span(&self) -> Span { | |||
match *self { | |||
TokenTree::Token(sp, _) => sp, | |||
TokenTree::Delimited(sp, _) => sp.entire(), | |||
TokenTree::Delimited(sp, _, _) => sp.entire(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: _, _
-> ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(There are many instances of this.)
@bors r+ |
📌 Commit 8e4ccef845e2870b60b08d77960b550f13ade2d3 has been approved by |
In case you'll want to fix #56369 (comment) |
✌️ @nnethercote can now approve this pull request |
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
8e4ccef
to
1fe2c03
Compare
I addressed the nits. @bors r=petrochenkov |
📌 Commit 1fe2c03 has been approved by |
Remove `tokenstream::Delimited`. Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
☀️ Test successful - status-appveyor, status-travis |
Because it's an extra type layer that doesn't really help; in a couple
of places it actively gets in the way, and overall removing it makes the
code nicer. It does, however, move
tokenstream::TokenTree
further awayfrom the
TokenTree
inquote.rs
.More importantly, this change reduces the size of
TokenStream
from 48bytes to 40 bytes on x86-64, which is enough to slightly reduce
instruction counts on numerous benchmarks, the best by 1.5%.
Note that
open_tt
andclose_tt
have gone from being methods onDelimited
to associated methods ofTokenTree
.